Commit 45e8bb50 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-core
parents e29d5f5c 3215ffe1
...@@ -32,8 +32,8 @@ object of this type. They must initialize the name field, and may ...@@ -32,8 +32,8 @@ object of this type. They must initialize the name field, and may
optionally initialize the match callback. optionally initialize the match callback.
struct bus_type pci_bus_type = { struct bus_type pci_bus_type = {
name: "pci", .name = "pci",
match: pci_bus_match, .match = pci_bus_match,
}; };
The structure should be exported to drivers in a header file: The structure should be exported to drivers in a header file:
......
...@@ -49,14 +49,14 @@ driver. This declaration is hypothetical only; it relies on the driver ...@@ -49,14 +49,14 @@ driver. This declaration is hypothetical only; it relies on the driver
being converted completely to the new model. being converted completely to the new model.
static struct device_driver eepro100_driver = { static struct device_driver eepro100_driver = {
name: "eepro100", .name = "eepro100",
bus: &pci_bus_type, .bus = &pci_bus_type,
devclass: &ethernet_devclass, /* when it's implemented */ .devclass = &ethernet_devclass, /* when it's implemented */
probe: eepro100_probe, .probe = eepro100_probe,
remove: eepro100_remove, .remove = eepro100_remove,
suspend: eepro100_suspend, .suspend = eepro100_suspend,
resume: eepro100_resume, .resume = eepro100_resume,
}; };
Most drivers will not be able to be converted completely to the new Most drivers will not be able to be converted completely to the new
...@@ -81,15 +81,15 @@ A definition that included bus-specific fields would look something ...@@ -81,15 +81,15 @@ A definition that included bus-specific fields would look something
like (using the eepro100 driver again): like (using the eepro100 driver again):
static struct pci_driver eepro100_driver = { static struct pci_driver eepro100_driver = {
id_table: eepro100_pci_tbl, .id_table = eepro100_pci_tbl,
driver: { .driver = {
name: "eepro100", .name = "eepro100",
bus: &pci_bus_type, .bus = &pci_bus_type,
devclass: &ethernet_devclass, /* when it's implemented */ .devclass = &ethernet_devclass, /* when it's implemented */
probe: eepro100_probe, .probe = eepro100_probe,
remove: eepro100_remove, .remove = eepro100_remove,
suspend: eepro100_suspend, .suspend = eepro100_suspend,
resume: eepro100_resume, .resume = eepro100_resume,
}, },
}; };
......
...@@ -86,11 +86,11 @@ whole sysfs filesystem anywhere in userspace. ...@@ -86,11 +86,11 @@ whole sysfs filesystem anywhere in userspace.
This can be done permanently by providing the following entry into the This can be done permanently by providing the following entry into the
/etc/fstab (under the provision that the mount point does exist, of course): /etc/fstab (under the provision that the mount point does exist, of course):
none /devices sysfs defaults 0 0 none /sys sysfs defaults 0 0
Or by hand on the command line: Or by hand on the command line:
~: mount -t sysfs none /devices # mount -t sysfs sysfs /devices
Whenever a device is inserted into the tree, a directory is created for it. Whenever a device is inserted into the tree, a directory is created for it.
This directory may be populated at each layer of discovery - the global layer, This directory may be populated at each layer of discovery - the global layer,
......
...@@ -6,12 +6,6 @@ Patrick Mochel <mochel@osdl.org> ...@@ -6,12 +6,6 @@ Patrick Mochel <mochel@osdl.org>
10 January 2003 10 January 2003
Note (17 Oct 2002): the name has just been changed from sysfs to
sysfs. Updates to the documentation will come soon; after the
conversion to use it is completely finished.
What it is: What it is:
~~~~~~~~~~~ ~~~~~~~~~~~
...@@ -271,8 +265,8 @@ for devices on that particular bus (this assmumes that drivers do not ...@@ -271,8 +265,8 @@ for devices on that particular bus (this assmumes that drivers do not
span multiple bus types). span multiple bus types).
More information can device-model specific features can be found in More information can driver-model specific features can be found in
Documentation/device-model/. Documentation/driver-model/.
TODO: Finish this section. TODO: Finish this section.
......
...@@ -28,10 +28,10 @@ struct device_driver node_driver = { ...@@ -28,10 +28,10 @@ struct device_driver node_driver = {
}; };
static ssize_t node_read_cpumap(struct device * dev, char * buf, size_t count, loff_t off) static ssize_t node_read_cpumap(struct device * dev, char * buf)
{ {
struct node *node_dev = to_node(to_root(dev)); struct node *node_dev = to_node(to_root(dev));
return off ? 0 : sprintf(buf,"%lx\n",node_dev->cpumap); return sprintf(buf,"%lx\n",node_dev->cpumap);
} }
static DEVICE_ATTR(cpumap,S_IRUGO,node_read_cpumap,NULL); static DEVICE_ATTR(cpumap,S_IRUGO,node_read_cpumap,NULL);
......
...@@ -431,10 +431,12 @@ int elv_register_queue(struct gendisk *disk) ...@@ -431,10 +431,12 @@ int elv_register_queue(struct gendisk *disk)
void elv_unregister_queue(struct gendisk *disk) void elv_unregister_queue(struct gendisk *disk)
{ {
request_queue_t *q = disk->queue; request_queue_t *q = disk->queue;
elevator_t *e = &q->elevator;
if (q) {
elevator_t * e = &q->elevator;
kobject_unregister(&e->kobj); kobject_unregister(&e->kobj);
kobject_put(&disk->kobj); kobject_put(&disk->kobj);
}
} }
elevator_t elevator_noop = { elevator_t elevator_noop = {
......
...@@ -616,13 +616,13 @@ chp_status_show(struct device *dev, char *buf) ...@@ -616,13 +616,13 @@ chp_status_show(struct device *dev, char *buf)
switch(chp->state) { switch(chp->state) {
case CHP_OFFLINE: case CHP_OFFLINE:
return snprintf(buf, count, "n/a\n"); return sprintf(buf, "n/a\n");
case CHP_LOGICALLY_OFFLINE: case CHP_LOGICALLY_OFFLINE:
return snprintf(buf, count, "logically offline\n"); return sprintf(buf, "logically offline\n");
case CHP_STANDBY: case CHP_STANDBY:
return snprintf(buf, count, "n/a\n"); return sprintf(buf, "n/a\n");
case CHP_ONLINE: case CHP_ONLINE:
return snprintf(buf, count, "online\n"); return sprintf(buf, "online\n");
default: default:
return 0; return 0;
} }
......
...@@ -2762,27 +2762,23 @@ ctc_init_netdevice(struct net_device * dev, int alloc_device, ...@@ -2762,27 +2762,23 @@ ctc_init_netdevice(struct net_device * dev, int alloc_device,
} }
static ssize_t static ssize_t
ctc_proto_show(struct device *dev, char *buf, size_t count, loff_t off) ctc_proto_show(struct device *dev, char *buf)
{ {
struct ctc_priv *priv; struct ctc_priv *priv;
if (off)
return 0;
priv = dev->driver_data; priv = dev->driver_data;
if (!priv) if (!priv)
return -ENODEV; return -ENODEV;
return snprintf(buf, count, "%d\n", priv->protocol); return sprintf(buf, "%d\n", priv->protocol);
} }
static ssize_t static ssize_t
ctc_proto_store(struct device *dev, const char *buf, size_t count, loff_t off) ctc_proto_store(struct device *dev, const char *buf, size_t count)
{ {
struct ctc_priv *priv; struct ctc_priv *priv;
int value; int value;
if (off)
return 0;
priv = dev->driver_data; priv = dev->driver_data;
if (!priv) if (!priv)
return -ENODEV; return -ENODEV;
......
...@@ -63,8 +63,7 @@ struct device cu3088_root_dev = { ...@@ -63,8 +63,7 @@ struct device cu3088_root_dev = {
}; };
static ssize_t static ssize_t
group_write(struct device_driver *drv, const char *buf, size_t count, group_write(struct device_driver *drv, const char *buf, size_t count)
loff_t off)
{ {
const char *start, *end; const char *start, *end;
char bus_ids[2][BUS_ID_SIZE], *argv[2]; char bus_ids[2][BUS_ID_SIZE], *argv[2];
...@@ -72,9 +71,6 @@ group_write(struct device_driver *drv, const char *buf, size_t count, ...@@ -72,9 +71,6 @@ group_write(struct device_driver *drv, const char *buf, size_t count,
int ret; int ret;
struct ccwgroup_driver *cdrv; struct ccwgroup_driver *cdrv;
if (off)
return 0;
cdrv = to_ccwgroupdrv(drv); cdrv = to_ccwgroupdrv(drv);
if (!cdrv) if (!cdrv)
return -EINVAL; return -EINVAL;
......
...@@ -1473,11 +1473,11 @@ txtime_show (struct device *dev, char *buf) ...@@ -1473,11 +1473,11 @@ txtime_show (struct device *dev, char *buf)
{ {
netiucv_priv *priv = dev->driver_data; netiucv_priv *priv = dev->driver_data;
return snprintf(buf, count, "%ld\n", priv->conn->prof.tx_time); return sprintf(buf, "%ld\n", priv->conn->prof.tx_time);
} }
static ssize_t static ssize_t
txtime_write (struct device *dev, const char *buf) txtime_write (struct device *dev, const char *buf, size_t count)
{ {
netiucv_priv *priv = dev->driver_data; netiucv_priv *priv = dev->driver_data;
......
...@@ -1192,20 +1192,17 @@ static int scsi_debug_proc_info(char *buffer, char **start, off_t offset, ...@@ -1192,20 +1192,17 @@ static int scsi_debug_proc_info(char *buffer, char **start, off_t offset,
return len; return len;
} }
static ssize_t sdebug_delay_read(struct device_driver * ddp, char * buf, static ssize_t sdebug_delay_read(struct device_driver * ddp, char * buf)
size_t count, loff_t off)
{ {
return off ? 0 : snprintf(buf, count, "%d\n", scsi_debug_delay); return sprintf(buf, "%d\n", scsi_debug_delay);
} }
static ssize_t sdebug_delay_write(struct device_driver * ddp, static ssize_t sdebug_delay_write(struct device_driver * ddp,
const char * buf, size_t count, loff_t off) const char * buf, size_t count)
{ {
int delay; int delay;
char work[20]; char work[20];
if (off)
return 0;
if (1 == sscanf(buf, "%10s", work)) { if (1 == sscanf(buf, "%10s", work)) {
if ((1 == sscanf(work, "%d", &delay)) && (delay >= 0)) { if ((1 == sscanf(work, "%d", &delay)) && (delay >= 0)) {
scsi_debug_delay = delay; scsi_debug_delay = delay;
...@@ -1217,20 +1214,17 @@ static ssize_t sdebug_delay_write(struct device_driver * ddp, ...@@ -1217,20 +1214,17 @@ static ssize_t sdebug_delay_write(struct device_driver * ddp,
DRIVER_ATTR(delay, S_IRUGO | S_IWUSR, sdebug_delay_read, DRIVER_ATTR(delay, S_IRUGO | S_IWUSR, sdebug_delay_read,
sdebug_delay_write) sdebug_delay_write)
static ssize_t sdebug_opts_read(struct device_driver * ddp, char * buf, static ssize_t sdebug_opts_read(struct device_driver * ddp, char * buf)
size_t count, loff_t off)
{ {
return off ? 0 : snprintf(buf, count, "0x%x\n", scsi_debug_opts); return sprintf(buf, "0x%x\n", scsi_debug_opts);
} }
static ssize_t sdebug_opts_write(struct device_driver * ddp, static ssize_t sdebug_opts_write(struct device_driver * ddp,
const char * buf, size_t count, loff_t off) const char * buf, size_t count)
{ {
int opts; int opts;
char work[20]; char work[20];
if (off)
return 0;
if (1 == sscanf(buf, "%10s", work)) { if (1 == sscanf(buf, "%10s", work)) {
if (0 == strnicmp(work,"0x", 2)) { if (0 == strnicmp(work,"0x", 2)) {
if (1 == sscanf(&work[2], "%x", &opts)) if (1 == sscanf(&work[2], "%x", &opts))
...@@ -1248,55 +1242,47 @@ static ssize_t sdebug_opts_write(struct device_driver * ddp, ...@@ -1248,55 +1242,47 @@ static ssize_t sdebug_opts_write(struct device_driver * ddp,
DRIVER_ATTR(opts, S_IRUGO | S_IWUSR, sdebug_opts_read, DRIVER_ATTR(opts, S_IRUGO | S_IWUSR, sdebug_opts_read,
sdebug_opts_write) sdebug_opts_write)
static ssize_t sdebug_num_devs_read(struct device_driver * ddp, char * buf, static ssize_t sdebug_num_devs_read(struct device_driver * ddp, char * buf)
size_t count, loff_t off)
{ {
return off ? 0 : snprintf(buf, count, "%d\n", scsi_debug_num_devs); return sprintf(buf, "%d\n", scsi_debug_num_devs);
} }
DRIVER_ATTR(num_devs, S_IRUGO, sdebug_num_devs_read, NULL) DRIVER_ATTR(num_devs, S_IRUGO, sdebug_num_devs_read, NULL)
static ssize_t sdebug_dev_size_mb_read(struct device_driver * ddp, char * buf, static ssize_t sdebug_dev_size_mb_read(struct device_driver * ddp, char * buf)
size_t count, loff_t off)
{ {
return off ? 0 : snprintf(buf, count, "%d\n", scsi_debug_dev_size_mb); return sprintf(buf, "%d\n", scsi_debug_dev_size_mb);
} }
DRIVER_ATTR(dev_size_mb, S_IRUGO, sdebug_dev_size_mb_read, NULL) DRIVER_ATTR(dev_size_mb, S_IRUGO, sdebug_dev_size_mb_read, NULL)
static ssize_t sdebug_every_nth_read(struct device_driver * ddp, char * buf, static ssize_t sdebug_every_nth_read(struct device_driver * ddp, char * buf)
size_t count, loff_t off)
{ {
return off ? 0 : snprintf(buf, count, "%d\n", scsi_debug_every_nth); return sprintf(buf, "%d\n", scsi_debug_every_nth);
} }
DRIVER_ATTR(every_nth, S_IRUGO, sdebug_every_nth_read, NULL) DRIVER_ATTR(every_nth, S_IRUGO, sdebug_every_nth_read, NULL)
static ssize_t sdebug_max_luns_read(struct device_driver * ddp, char * buf, static ssize_t sdebug_max_luns_read(struct device_driver * ddp, char * buf)
size_t count, loff_t off)
{ {
return off ? 0 : snprintf(buf, count, "%d\n", scsi_debug_max_luns); return sprintf(buf, "%d\n", scsi_debug_max_luns);
} }
DRIVER_ATTR(max_luns, S_IRUGO, sdebug_max_luns_read, NULL) DRIVER_ATTR(max_luns, S_IRUGO, sdebug_max_luns_read, NULL)
static ssize_t sdebug_scsi_level_read(struct device_driver * ddp, char * buf, static ssize_t sdebug_scsi_level_read(struct device_driver * ddp, char * buf)
size_t count, loff_t off)
{ {
return off ? 0 : snprintf(buf, count, "%d\n", scsi_debug_scsi_level); return sprintf(buf, "%d\n", scsi_debug_scsi_level);
} }
DRIVER_ATTR(scsi_level, S_IRUGO, sdebug_scsi_level_read, NULL) DRIVER_ATTR(scsi_level, S_IRUGO, sdebug_scsi_level_read, NULL)
static ssize_t sdebug_add_host_read(struct device_driver * ddp, char * buf, static ssize_t sdebug_add_host_read(struct device_driver * ddp, char * buf)
size_t count, loff_t off)
{ {
return off ? 0 : snprintf(buf, count, "%d\n", scsi_debug_add_host); return sprintf(buf, "%d\n", scsi_debug_add_host);
} }
static ssize_t sdebug_add_host_write(struct device_driver * ddp, static ssize_t sdebug_add_host_write(struct device_driver * ddp,
const char * buf, size_t count, loff_t off) const char * buf, size_t count)
{ {
int delta_hosts, k; int delta_hosts, k;
char work[20]; char work[20];
if (off)
return 0;
if (1 != sscanf(buf, "%10s", work)) if (1 != sscanf(buf, "%10s", work))
return -EINVAL; return -EINVAL;
{ /* temporary hack around sscanf() problem with -ve nums */ { /* temporary hack around sscanf() problem with -ve nums */
......
...@@ -87,7 +87,7 @@ static inline void kset_put(struct kset * k) ...@@ -87,7 +87,7 @@ static inline void kset_put(struct kset * k)
} }
extern struct kobject * kset_find_obj(struct kset *, char *); extern struct kobject * kset_find_obj(struct kset *, const char *);
struct subsystem { struct subsystem {
......
...@@ -295,7 +295,7 @@ void kset_unregister(struct kset * k) ...@@ -295,7 +295,7 @@ void kset_unregister(struct kset * k)
* looking for a matching kobject. Return object if found. * looking for a matching kobject. Return object if found.
*/ */
struct kobject * kset_find_obj(struct kset * kset, char * name) struct kobject * kset_find_obj(struct kset * kset, const char * name)
{ {
struct list_head * entry; struct list_head * entry;
struct kobject * ret = NULL; struct kobject * ret = NULL;
...@@ -387,6 +387,8 @@ EXPORT_SYMBOL(kobject_unregister); ...@@ -387,6 +387,8 @@ EXPORT_SYMBOL(kobject_unregister);
EXPORT_SYMBOL(kobject_get); EXPORT_SYMBOL(kobject_get);
EXPORT_SYMBOL(kobject_put); EXPORT_SYMBOL(kobject_put);
EXPORT_SYMBOL(kset_find_obj);
EXPORT_SYMBOL(subsystem_init); EXPORT_SYMBOL(subsystem_init);
EXPORT_SYMBOL(subsystem_register); EXPORT_SYMBOL(subsystem_register);
EXPORT_SYMBOL(subsystem_unregister); EXPORT_SYMBOL(subsystem_unregister);
......
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