Commit 28d7baf8 authored by Anton Blanchard's avatar Anton Blanchard

Merge samba.org:/scratch/anton/linux-2.5

into samba.org:/scratch/anton/for-alan
parents c5ae7458 4edfd8c3
......@@ -32,8 +32,8 @@ object of this type. They must initialize the name field, and may
optionally initialize the match callback.
struct bus_type pci_bus_type = {
name: "pci",
match: pci_bus_match,
.name = "pci",
.match = pci_bus_match,
};
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
being converted completely to the new model.
static struct device_driver eepro100_driver = {
name: "eepro100",
bus: &pci_bus_type,
devclass: &ethernet_devclass, /* when it's implemented */
.name = "eepro100",
.bus = &pci_bus_type,
.devclass = &ethernet_devclass, /* when it's implemented */
probe: eepro100_probe,
remove: eepro100_remove,
suspend: eepro100_suspend,
resume: eepro100_resume,
.probe = eepro100_probe,
.remove = eepro100_remove,
.suspend = eepro100_suspend,
.resume = eepro100_resume,
};
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
like (using the eepro100 driver again):
static struct pci_driver eepro100_driver = {
id_table: eepro100_pci_tbl,
driver: {
name: "eepro100",
bus: &pci_bus_type,
devclass: &ethernet_devclass, /* when it's implemented */
probe: eepro100_probe,
remove: eepro100_remove,
suspend: eepro100_suspend,
resume: eepro100_resume,
.id_table = eepro100_pci_tbl,
.driver = {
.name = "eepro100",
.bus = &pci_bus_type,
.devclass = &ethernet_devclass, /* when it's implemented */
.probe = eepro100_probe,
.remove = eepro100_remove,
.suspend = eepro100_suspend,
.resume = eepro100_resume,
},
};
......
......@@ -86,11 +86,11 @@ whole sysfs filesystem anywhere in userspace.
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):
none /devices sysfs defaults 0 0
none /sys sysfs defaults 0 0
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.
This directory may be populated at each layer of discovery - the global layer,
......
......@@ -6,12 +6,6 @@ Patrick Mochel <mochel@osdl.org>
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:
~~~~~~~~~~~
......@@ -271,8 +265,8 @@ for devices on that particular bus (this assmumes that drivers do not
span multiple bus types).
More information can device-model specific features can be found in
Documentation/device-model/.
More information can driver-model specific features can be found in
Documentation/driver-model/.
TODO: Finish this section.
......
......@@ -282,26 +282,23 @@ static int bus_match(struct device * dev, struct device_driver * drv)
* Walk the list of drivers that the bus has and call bus_match()
* for each pair. If a compatible pair is found, break out and return.
*/
static int device_attach(struct device * dev)
static void device_attach(struct device * dev)
{
struct bus_type * bus = dev->bus;
struct list_head * entry;
int error = 0;
if (dev->driver) {
device_bind_driver(dev);
return 0;
return;
}
if (!bus->match)
return 0;
list_for_each(entry,&bus->drivers.list) {
struct device_driver * drv = to_drv(entry);
if (!(error = bus_match(dev,drv)))
break;
if (bus->match) {
list_for_each(entry,&bus->drivers.list) {
struct device_driver * drv = to_drv(entry);
if (!bus_match(dev,drv))
break;
}
}
return error;
}
......@@ -318,22 +315,21 @@ static int device_attach(struct device * dev)
* Note that we ignore the error from bus_match(), since it's perfectly
* valid for a driver not to bind to any devices.
*/
static int driver_attach(struct device_driver * drv)
static void driver_attach(struct device_driver * drv)
{
struct bus_type * bus = drv->bus;
struct list_head * entry;
if (!bus->match)
return 0;
return;
list_for_each(entry,&bus->devices.list) {
struct device * dev = container_of(entry,struct device,bus_list);
if (!dev->driver) {
if (!bus_match(dev,drv) && dev->driver)
if (!bus_match(dev,drv))
devclass_add_device(dev);
}
}
return 0;
}
......@@ -393,8 +389,7 @@ int bus_add_device(struct device * dev)
down_write(&dev->bus->subsys.rwsem);
pr_debug("bus %s: add device %s\n",bus->name,dev->bus_id);
list_add_tail(&dev->bus_list,&dev->bus->devices.list);
if ((error = device_attach(dev)))
list_del_init(&dev->bus_list);
device_attach(dev);
up_write(&dev->bus->subsys.rwsem);
sysfs_create_link(&bus->devices.kobj,&dev->kobj,dev->bus_id);
}
......@@ -446,11 +441,8 @@ int bus_add_driver(struct device_driver * drv)
}
down_write(&bus->subsys.rwsem);
if (!(error = devclass_add_driver(drv))) {
if ((error = driver_attach(drv))) {
devclass_remove_driver(drv);
}
}
if (!(error = devclass_add_driver(drv)))
driver_attach(drv);
up_write(&bus->subsys.rwsem);
if (error) {
......
......@@ -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));
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);
......
......@@ -431,10 +431,12 @@ int elv_register_queue(struct gendisk *disk)
void elv_unregister_queue(struct gendisk *disk)
{
request_queue_t *q = disk->queue;
elevator_t *e = &q->elevator;
kobject_unregister(&e->kobj);
kobject_put(&disk->kobj);
if (q) {
elevator_t * e = &q->elevator;
kobject_unregister(&e->kobj);
kobject_put(&disk->kobj);
}
}
elevator_t elevator_noop = {
......
......@@ -616,13 +616,13 @@ chp_status_show(struct device *dev, char *buf)
switch(chp->state) {
case CHP_OFFLINE:
return snprintf(buf, count, "n/a\n");
return sprintf(buf, "n/a\n");
case CHP_LOGICALLY_OFFLINE:
return snprintf(buf, count, "logically offline\n");
return sprintf(buf, "logically offline\n");
case CHP_STANDBY:
return snprintf(buf, count, "n/a\n");
return sprintf(buf, "n/a\n");
case CHP_ONLINE:
return snprintf(buf, count, "online\n");
return sprintf(buf, "online\n");
default:
return 0;
}
......
......@@ -2762,27 +2762,23 @@ ctc_init_netdevice(struct net_device * dev, int alloc_device,
}
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;
if (off)
return 0;
priv = dev->driver_data;
if (!priv)
return -ENODEV;
return snprintf(buf, count, "%d\n", priv->protocol);
return sprintf(buf, "%d\n", priv->protocol);
}
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;
int value;
if (off)
return 0;
priv = dev->driver_data;
if (!priv)
return -ENODEV;
......
......@@ -63,8 +63,7 @@ struct device cu3088_root_dev = {
};
static ssize_t
group_write(struct device_driver *drv, const char *buf, size_t count,
loff_t off)
group_write(struct device_driver *drv, const char *buf, size_t count)
{
const char *start, *end;
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,
int ret;
struct ccwgroup_driver *cdrv;
if (off)
return 0;
cdrv = to_ccwgroupdrv(drv);
if (!cdrv)
return -EINVAL;
......
......@@ -1473,11 +1473,11 @@ txtime_show (struct device *dev, char *buf)
{
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
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;
......
......@@ -1192,20 +1192,17 @@ static int scsi_debug_proc_info(char *buffer, char **start, off_t offset,
return len;
}
static ssize_t sdebug_delay_read(struct device_driver * ddp, char * buf,
size_t count, loff_t off)
static ssize_t sdebug_delay_read(struct device_driver * ddp, char * buf)
{
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,
const char * buf, size_t count, loff_t off)
const char * buf, size_t count)
{
int delay;
char work[20];
if (off)
return 0;
if (1 == sscanf(buf, "%10s", work)) {
if ((1 == sscanf(work, "%d", &delay)) && (delay >= 0)) {
scsi_debug_delay = delay;
......@@ -1217,20 +1214,17 @@ static ssize_t sdebug_delay_write(struct device_driver * ddp,
DRIVER_ATTR(delay, S_IRUGO | S_IWUSR, sdebug_delay_read,
sdebug_delay_write)
static ssize_t sdebug_opts_read(struct device_driver * ddp, char * buf,
size_t count, loff_t off)
static ssize_t sdebug_opts_read(struct device_driver * ddp, char * buf)
{
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,
const char * buf, size_t count, loff_t off)
const char * buf, size_t count)
{
int opts;
char work[20];
if (off)
return 0;
if (1 == sscanf(buf, "%10s", work)) {
if (0 == strnicmp(work,"0x", 2)) {
if (1 == sscanf(&work[2], "%x", &opts))
......@@ -1248,55 +1242,47 @@ static ssize_t sdebug_opts_write(struct device_driver * ddp,
DRIVER_ATTR(opts, S_IRUGO | S_IWUSR, sdebug_opts_read,
sdebug_opts_write)
static ssize_t sdebug_num_devs_read(struct device_driver * ddp, char * buf,
size_t count, loff_t off)
static ssize_t sdebug_num_devs_read(struct device_driver * ddp, char * buf)
{
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)
static ssize_t sdebug_dev_size_mb_read(struct device_driver * ddp, char * buf,
size_t count, loff_t off)
static ssize_t sdebug_dev_size_mb_read(struct device_driver * ddp, char * buf)
{
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)
static ssize_t sdebug_every_nth_read(struct device_driver * ddp, char * buf,
size_t count, loff_t off)
static ssize_t sdebug_every_nth_read(struct device_driver * ddp, char * buf)
{
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)
static ssize_t sdebug_max_luns_read(struct device_driver * ddp, char * buf,
size_t count, loff_t off)
static ssize_t sdebug_max_luns_read(struct device_driver * ddp, char * buf)
{
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)
static ssize_t sdebug_scsi_level_read(struct device_driver * ddp, char * buf,
size_t count, loff_t off)
static ssize_t sdebug_scsi_level_read(struct device_driver * ddp, char * buf)
{
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)
static ssize_t sdebug_add_host_read(struct device_driver * ddp, char * buf,
size_t count, loff_t off)
static ssize_t sdebug_add_host_read(struct device_driver * ddp, char * buf)
{
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,
const char * buf, size_t count, loff_t off)
const char * buf, size_t count)
{
int delta_hosts, k;
char work[20];
if (off)
return 0;
if (1 != sscanf(buf, "%10s", work))
return -EINVAL;
{ /* temporary hack around sscanf() problem with -ve nums */
......
......@@ -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 {
......
......@@ -295,7 +295,7 @@ void kset_unregister(struct kset * k)
* 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 kobject * ret = NULL;
......@@ -387,6 +387,8 @@ EXPORT_SYMBOL(kobject_unregister);
EXPORT_SYMBOL(kobject_get);
EXPORT_SYMBOL(kobject_put);
EXPORT_SYMBOL(kset_find_obj);
EXPORT_SYMBOL(subsystem_init);
EXPORT_SYMBOL(subsystem_register);
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