Commit 44013500 authored by Patrick Mochel's avatar Patrick Mochel

Merge osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virgin

into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-driverfs
parents 80e4e144 d470409a
...@@ -165,9 +165,9 @@ Note that there is a struct attribute embedded in the structure. In ...@@ -165,9 +165,9 @@ Note that there is a struct attribute embedded in the structure. In
order to relieve pain in declaring attributes, the subsystem should order to relieve pain in declaring attributes, the subsystem should
also define a macro, like: also define a macro, like:
#define DEVICE_ATTR(_name,_str,_mode,_show,_store) \ #define DEVICE_ATTR(_name,_mode,_show,_store) \
struct device_attribute dev_attr_##_name = { \ struct device_attribute dev_attr_##_name = { \
.attr = {.name = _str, .mode = _mode }, \ .attr = {.name = __stringify(_name) , .mode = _mode }, \
.show = _show, \ .show = _show, \
.store = _store, \ .store = _store, \
}; };
...@@ -252,7 +252,7 @@ struct bus_attribute { ...@@ -252,7 +252,7 @@ struct bus_attribute {
Declaring: Declaring:
BUS_ATTR(_name,_str,_mode,_show,_store) BUS_ATTR(_name,_mode,_show,_store)
Creation/Removal: Creation/Removal:
...@@ -273,7 +273,7 @@ struct driver_attribute { ...@@ -273,7 +273,7 @@ struct driver_attribute {
Declaring: Declaring:
DRIVER_ATTR(_name,_str,_mode,_show,_store) DRIVER_ATTR(_name,_mode,_show,_store)
Creation/Removal: Creation/Removal:
......
...@@ -14,7 +14,7 @@ static ssize_t device_read_name(struct device * dev, char * buf, size_t count, l ...@@ -14,7 +14,7 @@ static ssize_t device_read_name(struct device * dev, char * buf, size_t count, l
return off ? 0 : sprintf(buf,"%s\n",dev->name); return off ? 0 : sprintf(buf,"%s\n",dev->name);
} }
static DEVICE_ATTR(name,"name",S_IRUGO,device_read_name,NULL); static DEVICE_ATTR(name,S_IRUGO,device_read_name,NULL);
static ssize_t static ssize_t
device_read_power(struct device * dev, char * page, size_t count, loff_t off) device_read_power(struct device * dev, char * page, size_t count, loff_t off)
...@@ -85,7 +85,7 @@ device_write_power(struct device * dev, const char * buf, size_t count, loff_t o ...@@ -85,7 +85,7 @@ device_write_power(struct device * dev, const char * buf, size_t count, loff_t o
return error < 0 ? error : count; return error < 0 ? error : count;
} }
static DEVICE_ATTR(power,"power",S_IWUSR | S_IRUGO, static DEVICE_ATTR(power,S_IWUSR | S_IRUGO,
device_read_power,device_write_power); device_read_power,device_write_power);
struct device_attribute * device_default_files[] = { struct device_attribute * device_default_files[] = {
......
...@@ -378,7 +378,7 @@ static ssize_t pci_show_irq(struct device * dev, char * buf, size_t count, loff_ ...@@ -378,7 +378,7 @@ static ssize_t pci_show_irq(struct device * dev, char * buf, size_t count, loff_
return off ? 0 : sprintf(buf,"%u\n",pci_dev->irq); return off ? 0 : sprintf(buf,"%u\n",pci_dev->irq);
} }
static DEVICE_ATTR(irq,"irq",S_IRUGO,pci_show_irq,NULL); static DEVICE_ATTR(irq,S_IRUGO,pci_show_irq,NULL);
static ssize_t pci_show_resources(struct device * dev, char * buf, size_t count, loff_t off) static ssize_t pci_show_resources(struct device * dev, char * buf, size_t count, loff_t off)
{ {
...@@ -402,7 +402,7 @@ static ssize_t pci_show_resources(struct device * dev, char * buf, size_t count, ...@@ -402,7 +402,7 @@ static ssize_t pci_show_resources(struct device * dev, char * buf, size_t count,
return (str - buf); return (str - buf);
} }
static DEVICE_ATTR(resource,"resource",S_IRUGO,pci_show_resources,NULL); static DEVICE_ATTR(resource,S_IRUGO,pci_show_resources,NULL);
int pci_proc_attach_device(struct pci_dev *dev) int pci_proc_attach_device(struct pci_dev *dev)
{ {
......
...@@ -305,7 +305,7 @@ static ssize_t scsi_device_type_read(struct device *driverfs_dev, char *page, ...@@ -305,7 +305,7 @@ static ssize_t scsi_device_type_read(struct device *driverfs_dev, char *page,
return 0; return 0;
} }
static DEVICE_ATTR(type,"type",S_IRUGO,scsi_device_type_read,NULL); static DEVICE_ATTR(type,S_IRUGO,scsi_device_type_read,NULL);
/* end content handlers */ /* end content handlers */
......
...@@ -1401,14 +1401,14 @@ static ssize_t sg_device_kdev_read(struct device *driverfs_dev, char *page, ...@@ -1401,14 +1401,14 @@ static ssize_t sg_device_kdev_read(struct device *driverfs_dev, char *page,
Sg_device * sdp=list_entry(driverfs_dev, Sg_device, sg_driverfs_dev); Sg_device * sdp=list_entry(driverfs_dev, Sg_device, sg_driverfs_dev);
return off ? 0 : sprintf(page, "%x\n",sdp->i_rdev.value); return off ? 0 : sprintf(page, "%x\n",sdp->i_rdev.value);
} }
static DEVICE_ATTR(kdev,"kdev",S_IRUGO,sg_device_kdev_read,NULL); static DEVICE_ATTR(kdev,S_IRUGO,sg_device_kdev_read,NULL);
static ssize_t sg_device_type_read(struct device *driverfs_dev, char *page, static ssize_t sg_device_type_read(struct device *driverfs_dev, char *page,
size_t count, loff_t off) size_t count, loff_t off)
{ {
return off ? 0 : sprintf (page, "CHR\n"); return off ? 0 : sprintf (page, "CHR\n");
} }
static DEVICE_ATTR(type,"type",S_IRUGO,sg_device_type_read,NULL); static DEVICE_ATTR(type,S_IRUGO,sg_device_type_read,NULL);
static int sg_attach(Scsi_Device * scsidp) static int sg_attach(Scsi_Device * scsidp)
{ {
......
...@@ -737,14 +737,14 @@ static ssize_t sr_device_kdev_read(struct device *driverfs_dev, ...@@ -737,14 +737,14 @@ static ssize_t sr_device_kdev_read(struct device *driverfs_dev,
kdev.value=(int)driverfs_dev->driver_data; kdev.value=(int)driverfs_dev->driver_data;
return off ? 0 : sprintf(page, "%x\n",kdev.value); return off ? 0 : sprintf(page, "%x\n",kdev.value);
} }
static DEVICE_ATTR(kdev,"kdev",S_IRUGO,sr_device_kdev_read,NULL); static DEVICE_ATTR(kdev,S_IRUGO,sr_device_kdev_read,NULL);
static ssize_t sr_device_type_read(struct device *driverfs_dev, static ssize_t sr_device_type_read(struct device *driverfs_dev,
char *page, size_t count, loff_t off) char *page, size_t count, loff_t off)
{ {
return off ? 0 : sprintf (page, "CHR\n"); return off ? 0 : sprintf (page, "CHR\n");
} }
static DEVICE_ATTR(type,"type",S_IRUGO,sr_device_type_read,NULL); static DEVICE_ATTR(type,S_IRUGO,sr_device_type_read,NULL);
void sr_finish() void sr_finish()
......
...@@ -3533,14 +3533,14 @@ static ssize_t st_device_kdev_read(struct device *driverfs_dev, ...@@ -3533,14 +3533,14 @@ static ssize_t st_device_kdev_read(struct device *driverfs_dev,
kdev.value=(int)driverfs_dev->driver_data; kdev.value=(int)driverfs_dev->driver_data;
return off ? 0 : sprintf(page, "%x\n",kdev.value); return off ? 0 : sprintf(page, "%x\n",kdev.value);
} }
static DEVICE_ATTR(kdev,"kdev",S_IRUGO,st_device_kdev_read,NULL); static DEVICE_ATTR(kdev,S_IRUGO,st_device_kdev_read,NULL);
static ssize_t st_device_type_read(struct device *driverfs_dev, static ssize_t st_device_type_read(struct device *driverfs_dev,
char *page, size_t count, loff_t off) char *page, size_t count, loff_t off)
{ {
return off ? 0 : sprintf (page, "CHR\n"); return off ? 0 : sprintf (page, "CHR\n");
} }
static DEVICE_ATTR(type,"type",S_IRUGO,st_device_type_read,NULL); static DEVICE_ATTR(type,S_IRUGO,st_device_type_read,NULL);
static struct file_operations st_fops = static struct file_operations st_fops =
......
...@@ -836,7 +836,7 @@ show_config (struct device *dev, char *buf, size_t count, loff_t off) ...@@ -836,7 +836,7 @@ show_config (struct device *dev, char *buf, size_t count, loff_t off)
return sprintf (buf, "%u\n", udev->actconfig->bConfigurationValue); return sprintf (buf, "%u\n", udev->actconfig->bConfigurationValue);
} }
static DEVICE_ATTR(config,"configuration",S_IRUGO,show_config,NULL); static DEVICE_ATTR(configuration,S_IRUGO,show_config,NULL);
/* interfaces have one current setting; alternates /* interfaces have one current setting; alternates
* can have different endpoints and class info. * can have different endpoints and class info.
...@@ -851,7 +851,7 @@ show_altsetting (struct device *dev, char *buf, size_t count, loff_t off) ...@@ -851,7 +851,7 @@ show_altsetting (struct device *dev, char *buf, size_t count, loff_t off)
interface = to_usb_interface (dev); interface = to_usb_interface (dev);
return sprintf (buf, "%u\n", interface->altsetting->bAlternateSetting); return sprintf (buf, "%u\n", interface->altsetting->bAlternateSetting);
} }
static DEVICE_ATTR(altsetting,"altsetting",S_IRUGO,show_altsetting,NULL); static DEVICE_ATTR(altsetting,S_IRUGO,show_altsetting,NULL);
/* product driverfs file */ /* product driverfs file */
static ssize_t show_product (struct device *dev, char *buf, size_t count, loff_t off) static ssize_t show_product (struct device *dev, char *buf, size_t count, loff_t off)
...@@ -868,7 +868,7 @@ static ssize_t show_product (struct device *dev, char *buf, size_t count, loff_t ...@@ -868,7 +868,7 @@ static ssize_t show_product (struct device *dev, char *buf, size_t count, loff_t
buf[len+1] = 0x00; buf[len+1] = 0x00;
return len+1; return len+1;
} }
static DEVICE_ATTR(product,"product",S_IRUGO,show_product,NULL); static DEVICE_ATTR(product,S_IRUGO,show_product,NULL);
/* manufacturer driverfs file */ /* manufacturer driverfs file */
static ssize_t static ssize_t
...@@ -886,7 +886,7 @@ show_manufacturer (struct device *dev, char *buf, size_t count, loff_t off) ...@@ -886,7 +886,7 @@ show_manufacturer (struct device *dev, char *buf, size_t count, loff_t off)
buf[len+1] = 0x00; buf[len+1] = 0x00;
return len+1; return len+1;
} }
static DEVICE_ATTR(manufacturer,"manufacturer",S_IRUGO,show_manufacturer,NULL); static DEVICE_ATTR(manufacturer,S_IRUGO,show_manufacturer,NULL);
/* serial number driverfs file */ /* serial number driverfs file */
static ssize_t static ssize_t
...@@ -904,7 +904,7 @@ show_serial (struct device *dev, char *buf, size_t count, loff_t off) ...@@ -904,7 +904,7 @@ show_serial (struct device *dev, char *buf, size_t count, loff_t off)
buf[len+1] = 0x00; buf[len+1] = 0x00;
return len+1; return len+1;
} }
static DEVICE_ATTR(serial,"serial",S_IRUGO,show_serial,NULL); static DEVICE_ATTR(serial,S_IRUGO,show_serial,NULL);
/* /*
* This entrypoint gets called for each new device. * This entrypoint gets called for each new device.
...@@ -1434,7 +1434,7 @@ int usb_new_device(struct usb_device *dev) ...@@ -1434,7 +1434,7 @@ int usb_new_device(struct usb_device *dev)
err = device_register (&dev->dev); err = device_register (&dev->dev);
if (err) if (err)
return err; return err;
device_create_file (&dev->dev, &dev_attr_config); device_create_file (&dev->dev, &dev_attr_configuration);
if (dev->descriptor.iManufacturer) if (dev->descriptor.iManufacturer)
device_create_file (&dev->dev, &dev_attr_manufacturer); device_create_file (&dev->dev, &dev_attr_manufacturer);
if (dev->descriptor.iProduct) if (dev->descriptor.iProduct)
......
...@@ -175,14 +175,14 @@ static ssize_t partition_device_kdev_read(struct device *driverfs_dev, ...@@ -175,14 +175,14 @@ static ssize_t partition_device_kdev_read(struct device *driverfs_dev,
kdev.value=(int)(long)driverfs_dev->driver_data; kdev.value=(int)(long)driverfs_dev->driver_data;
return off ? 0 : sprintf (page, "%x\n",kdev.value); return off ? 0 : sprintf (page, "%x\n",kdev.value);
} }
static DEVICE_ATTR(kdev,"kdev",S_IRUGO,partition_device_kdev_read,NULL); static DEVICE_ATTR(kdev,S_IRUGO,partition_device_kdev_read,NULL);
static ssize_t partition_device_type_read(struct device *driverfs_dev, static ssize_t partition_device_type_read(struct device *driverfs_dev,
char *page, size_t count, loff_t off) char *page, size_t count, loff_t off)
{ {
return off ? 0 : sprintf (page, "BLK\n"); return off ? 0 : sprintf (page, "BLK\n");
} }
static DEVICE_ATTR(type,"type",S_IRUGO,partition_device_type_read,NULL); static DEVICE_ATTR(type,S_IRUGO,partition_device_type_read,NULL);
void driverfs_create_partitions(struct gendisk *hd, int minor) void driverfs_create_partitions(struct gendisk *hd, int minor)
{ {
......
...@@ -93,9 +93,9 @@ struct bus_attribute { ...@@ -93,9 +93,9 @@ struct bus_attribute {
ssize_t (*store)(struct bus_type *, const char * buf, size_t count, loff_t off); ssize_t (*store)(struct bus_type *, const char * buf, size_t count, loff_t off);
}; };
#define BUS_ATTR(_name,_str,_mode,_show,_store) \ #define BUS_ATTR(_name,_mode,_show,_store) \
struct bus_attribute bus_attr_##_name = { \ struct bus_attribute bus_attr_##_name = { \
.attr = {.name = _str, .mode = _mode }, \ .attr = {.name = __stringify(_name), .mode = _mode }, \
.show = _show, \ .show = _show, \
.store = _store, \ .store = _store, \
}; };
...@@ -150,9 +150,9 @@ struct driver_attribute { ...@@ -150,9 +150,9 @@ struct driver_attribute {
ssize_t (*store)(struct device_driver *, const char * buf, size_t count, loff_t off); ssize_t (*store)(struct device_driver *, const char * buf, size_t count, loff_t off);
}; };
#define DRIVER_ATTR(_name,_str,_mode,_show,_store) \ #define DRIVER_ATTR(_name,_mode,_show,_store) \
struct driver_attribute driver_attr_##_name = { \ struct driver_attribute driver_attr_##_name = { \
.attr = {.name = _str, .mode = _mode }, \ .attr = {.name = __stringify(_name), .mode = _mode }, \
.show = _show, \ .show = _show, \
.store = _store, \ .store = _store, \
}; };
...@@ -222,13 +222,14 @@ struct device_attribute { ...@@ -222,13 +222,14 @@ struct device_attribute {
ssize_t (*store)(struct device * dev, const char * buf, size_t count, loff_t off); ssize_t (*store)(struct device * dev, const char * buf, size_t count, loff_t off);
}; };
#define DEVICE_ATTR(_name,_str,_mode,_show,_store) \ #define DEVICE_ATTR(_name,_mode,_show,_store) \
struct device_attribute dev_attr_##_name = { \ struct device_attribute dev_attr_##_name = { \
.attr = {.name = _str, .mode = _mode }, \ .attr = {.name = __stringify(_name), .mode = _mode }, \
.show = _show, \ .show = _show, \
.store = _store, \ .store = _store, \
}; };
extern int device_create_file(struct device *device, struct device_attribute * entry); extern int device_create_file(struct device *device, struct device_attribute * entry);
extern void device_remove_file(struct device * dev, struct device_attribute * attr); extern void device_remove_file(struct device * dev, struct device_attribute * attr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment