ia64/linux-2.6.18-xen.hg

annotate drivers/macintosh/macio_sysfs.c @ 893:f994bfe9b93b

linux/blktap2: reduce TLB flush scope

c/s 885 added very coarse TLB flushing. Since these flushes always
follow single page updates, single page flushes (when available) are
sufficient.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jun 04 10:32:57 2009 +0100 (2009-06-04)
parents 831230e53067
children
rev   line source
ian@0 1 #include <linux/kernel.h>
ian@0 2 #include <linux/stat.h>
ian@0 3 #include <asm/macio.h>
ian@0 4
ian@0 5
ian@0 6 #define macio_config_of_attr(field, format_string) \
ian@0 7 static ssize_t \
ian@0 8 field##_show (struct device *dev, struct device_attribute *attr, \
ian@0 9 char *buf) \
ian@0 10 { \
ian@0 11 struct macio_dev *mdev = to_macio_device (dev); \
ian@0 12 return sprintf (buf, format_string, mdev->ofdev.node->field); \
ian@0 13 }
ian@0 14
ian@0 15 static ssize_t
ian@0 16 compatible_show (struct device *dev, struct device_attribute *attr, char *buf)
ian@0 17 {
ian@0 18 struct of_device *of;
ian@0 19 char *compat;
ian@0 20 int cplen;
ian@0 21 int length = 0;
ian@0 22
ian@0 23 of = &to_macio_device (dev)->ofdev;
ian@0 24 compat = (char *) get_property(of->node, "compatible", &cplen);
ian@0 25 if (!compat) {
ian@0 26 *buf = '\0';
ian@0 27 return 0;
ian@0 28 }
ian@0 29 while (cplen > 0) {
ian@0 30 int l;
ian@0 31 length += sprintf (buf, "%s\n", compat);
ian@0 32 buf += length;
ian@0 33 l = strlen (compat) + 1;
ian@0 34 compat += l;
ian@0 35 cplen -= l;
ian@0 36 }
ian@0 37
ian@0 38 return length;
ian@0 39 }
ian@0 40
ian@0 41 static ssize_t modalias_show (struct device *dev, struct device_attribute *attr,
ian@0 42 char *buf)
ian@0 43 {
ian@0 44 struct of_device *of;
ian@0 45 char *compat;
ian@0 46 int cplen;
ian@0 47 int length;
ian@0 48
ian@0 49 of = &to_macio_device (dev)->ofdev;
ian@0 50 compat = (char *) get_property (of->node, "compatible", &cplen);
ian@0 51 if (!compat) compat = "", cplen = 1;
ian@0 52 length = sprintf (buf, "of:N%sT%s", of->node->name, of->node->type);
ian@0 53 buf += length;
ian@0 54 while (cplen > 0) {
ian@0 55 int l;
ian@0 56 length += sprintf (buf, "C%s", compat);
ian@0 57 buf += length;
ian@0 58 l = strlen (compat) + 1;
ian@0 59 compat += l;
ian@0 60 cplen -= l;
ian@0 61 }
ian@0 62
ian@0 63 return length;
ian@0 64 }
ian@0 65
ian@0 66 macio_config_of_attr (name, "%s\n");
ian@0 67 macio_config_of_attr (type, "%s\n");
ian@0 68
ian@0 69 struct device_attribute macio_dev_attrs[] = {
ian@0 70 __ATTR_RO(name),
ian@0 71 __ATTR_RO(type),
ian@0 72 __ATTR_RO(compatible),
ian@0 73 __ATTR_RO(modalias),
ian@0 74 __ATTR_NULL
ian@0 75 };