diff options
author | Greg Kroah-Hartman | 2006-09-12 17:00:10 +0200 |
---|---|---|
committer | Greg Kroah-Hartman | 2007-02-07 10:37:11 -0800 |
commit | 873733188a019acdb7fa253011cbdc0a8afd97f3 (patch) | |
tree | 99828bd5db2f183e1b2d2204dc2c94bd1f8fdbbb /drivers/pcmcia | |
parent | 31b9025aa0f89b392077db3f87458fd46bcc4f58 (diff) |
Driver core: convert pcmcia code to use struct device
Converts from using struct "class_device" to "struct device" making
everything show up properly in /sys/devices/ with symlinks from the
/sys/class directory.
Cc: <linux-pcmcia@lists.infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r-- | drivers/pcmcia/cs.c | 34 | ||||
-rw-r--r-- | drivers/pcmcia/cs_internal.h | 4 | ||||
-rw-r--r-- | drivers/pcmcia/ds.c | 14 | ||||
-rw-r--r-- | drivers/pcmcia/i82092.c | 2 | ||||
-rw-r--r-- | drivers/pcmcia/i82365.c | 2 | ||||
-rw-r--r-- | drivers/pcmcia/pcmcia_ioctl.c | 1 | ||||
-rw-r--r-- | drivers/pcmcia/pcmcia_resource.c | 1 | ||||
-rw-r--r-- | drivers/pcmcia/pd6729.c | 2 | ||||
-rw-r--r-- | drivers/pcmcia/rsrc_nonstatic.c | 56 | ||||
-rw-r--r-- | drivers/pcmcia/soc_common.c | 6 | ||||
-rw-r--r-- | drivers/pcmcia/socket_sysfs.c | 104 | ||||
-rw-r--r-- | drivers/pcmcia/tcic.c | 2 | ||||
-rw-r--r-- | drivers/pcmcia/yenta_socket.c | 2 |
13 files changed, 126 insertions, 104 deletions
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index 606a46740338..ac004248324a 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c @@ -110,7 +110,7 @@ int pcmcia_socket_dev_suspend(struct device *dev, pm_message_t state) down_read(&pcmcia_socket_list_rwsem); list_for_each_entry(socket, &pcmcia_socket_list, socket_list) { - if (socket->dev.dev != dev) + if (socket->dev.parent != dev) continue; mutex_lock(&socket->skt_mutex); socket_suspend(socket); @@ -128,7 +128,7 @@ int pcmcia_socket_dev_resume(struct device *dev) down_read(&pcmcia_socket_list_rwsem); list_for_each_entry(socket, &pcmcia_socket_list, socket_list) { - if (socket->dev.dev != dev) + if (socket->dev.parent != dev) continue; mutex_lock(&socket->skt_mutex); socket_resume(socket); @@ -143,12 +143,12 @@ EXPORT_SYMBOL(pcmcia_socket_dev_resume); struct pcmcia_socket * pcmcia_get_socket(struct pcmcia_socket *skt) { - struct class_device *cl_dev = class_device_get(&skt->dev); - if (!cl_dev) + struct device *dev = get_device(&skt->dev); + if (!dev) return NULL; - skt = class_get_devdata(cl_dev); + skt = dev_get_drvdata(dev); if (!try_module_get(skt->owner)) { - class_device_put(&skt->dev); + put_device(&skt->dev); return NULL; } return (skt); @@ -159,14 +159,14 @@ EXPORT_SYMBOL(pcmcia_get_socket); void pcmcia_put_socket(struct pcmcia_socket *skt) { module_put(skt->owner); - class_device_put(&skt->dev); + put_device(&skt->dev); } EXPORT_SYMBOL(pcmcia_put_socket); -static void pcmcia_release_socket(struct class_device *class_dev) +static void pcmcia_release_socket(struct device *dev) { - struct pcmcia_socket *socket = class_get_devdata(class_dev); + struct pcmcia_socket *socket = dev_get_drvdata(dev); complete(&socket->socket_released); } @@ -181,7 +181,7 @@ int pcmcia_register_socket(struct pcmcia_socket *socket) struct task_struct *tsk; int ret; - if (!socket || !socket->ops || !socket->dev.dev || !socket->resource_ops) + if (!socket || !socket->ops || !socket->dev.parent || !socket->resource_ops) return -EINVAL; cs_dbg(socket, 0, "pcmcia_register_socket(0x%p)\n", socket->ops); @@ -226,9 +226,9 @@ int pcmcia_register_socket(struct pcmcia_socket *socket) #endif /* set proper values in socket->dev */ - socket->dev.class_data = socket; + dev_set_drvdata(&socket->dev, socket); socket->dev.class = &pcmcia_socket_class; - snprintf(socket->dev.class_id, BUS_ID_SIZE, "pcmcia_socket%u", socket->sock); + snprintf(socket->dev.bus_id, BUS_ID_SIZE, "pcmcia_socket%u", socket->sock); /* base address = 0, map = 0 */ socket->cis_mem.flags = 0; @@ -640,7 +640,7 @@ static int pccardd(void *__skt) skt->ops->set_socket(skt, &skt->socket); /* register with the device core */ - ret = class_device_register(&skt->dev); + ret = device_register(&skt->dev); if (ret) { printk(KERN_WARNING "PCMCIA: unable to register socket 0x%p\n", skt); @@ -689,7 +689,7 @@ static int pccardd(void *__skt) remove_wait_queue(&skt->thread_wait, &wait); /* remove from the device core */ - class_device_unregister(&skt->dev); + device_unregister(&skt->dev); return 0; } @@ -904,7 +904,7 @@ int pcmcia_insert_card(struct pcmcia_socket *skt) EXPORT_SYMBOL(pcmcia_insert_card); -static int pcmcia_socket_uevent(struct class_device *dev, char **envp, +static int pcmcia_socket_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) { struct pcmcia_socket *s = container_of(dev, struct pcmcia_socket, dev); @@ -930,8 +930,8 @@ static void pcmcia_release_socket_class(struct class *data) struct class pcmcia_socket_class = { .name = "pcmcia_socket", - .uevent = pcmcia_socket_uevent, - .release = pcmcia_release_socket, + .dev_uevent = pcmcia_socket_uevent, + .dev_release = pcmcia_release_socket, .class_release = pcmcia_release_socket_class, }; EXPORT_SYMBOL(pcmcia_socket_class); diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index f573ea04db6f..9fa207e3c7b3 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h @@ -142,7 +142,7 @@ struct pcmcia_callback{ int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c); -#define cs_socket_name(skt) ((skt)->dev.class_id) +#define cs_socket_name(skt) ((skt)->dev.bus_id) #ifdef DEBUG extern int cs_debug_level(int); @@ -158,6 +158,6 @@ extern int cs_debug_level(int); #endif #define cs_err(skt, fmt, arg...) \ - printk(KERN_ERR "cs: %s: " fmt, (skt)->dev.class_id , ## arg) + printk(KERN_ERR "cs: %s: " fmt, (skt)->dev.bus_id , ## arg) #endif /* _LINUX_CS_INTERNAL_H */ diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 7355eb455a88..18e111e12339 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -572,7 +572,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f p_dev->func = function; p_dev->dev.bus = &pcmcia_bus_type; - p_dev->dev.parent = s->dev.dev; + p_dev->dev.parent = s->dev.parent; p_dev->dev.release = pcmcia_release_dev; bus_id_len = sprintf (p_dev->dev.bus_id, "%d.%d", p_dev->socket->sock, p_dev->device_no); @@ -1328,10 +1328,10 @@ static struct pcmcia_callback pcmcia_bus_callback = { .resume = pcmcia_bus_resume, }; -static int __devinit pcmcia_bus_add_socket(struct class_device *class_dev, +static int __devinit pcmcia_bus_add_socket(struct device *dev, struct class_interface *class_intf) { - struct pcmcia_socket *socket = class_get_devdata(class_dev); + struct pcmcia_socket *socket = dev_get_drvdata(dev); int ret; socket = pcmcia_get_socket(socket); @@ -1364,10 +1364,10 @@ static int __devinit pcmcia_bus_add_socket(struct class_device *class_dev, return 0; } -static void pcmcia_bus_remove_socket(struct class_device *class_dev, +static void pcmcia_bus_remove_socket(struct device *dev, struct class_interface *class_intf) { - struct pcmcia_socket *socket = class_get_devdata(class_dev); + struct pcmcia_socket *socket = dev_get_drvdata(dev); if (!socket) return; @@ -1389,8 +1389,8 @@ static void pcmcia_bus_remove_socket(struct class_device *class_dev, /* the pcmcia_bus_interface is used to handle pcmcia socket devices */ static struct class_interface pcmcia_bus_interface = { .class = &pcmcia_socket_class, - .add = &pcmcia_bus_add_socket, - .remove = &pcmcia_bus_remove_socket, + .add_dev = &pcmcia_bus_add_socket, + .remove_dev = &pcmcia_bus_remove_socket, }; diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c index c2ea07aa7a12..df21e2d16f87 100644 --- a/drivers/pcmcia/i82092.c +++ b/drivers/pcmcia/i82092.c @@ -161,7 +161,7 @@ static int __devinit i82092aa_pci_probe(struct pci_dev *dev, const struct pci_de pci_set_drvdata(dev, &sockets[i].socket); for (i = 0; i<socket_count; i++) { - sockets[i].socket.dev.dev = &dev->dev; + sockets[i].socket.dev.parent = &dev->dev; sockets[i].socket.ops = &i82092aa_operations; sockets[i].socket.resource_ops = &pccard_nonstatic_ops; ret = pcmcia_register_socket(&sockets[i].socket); diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c index ea74f98a7350..72ff2f615b33 100644 --- a/drivers/pcmcia/i82365.c +++ b/drivers/pcmcia/i82365.c @@ -1298,7 +1298,7 @@ static int __init init_i82365(void) /* register sockets with the pcmcia core */ for (i = 0; i < sockets; i++) { - socket[i].socket.dev.dev = &i82365_device->dev; + socket[i].socket.dev.parent = &i82365_device->dev; socket[i].socket.ops = &pcic_operations; socket[i].socket.resource_ops = &pccard_nonstatic_ops; socket[i].socket.owner = THIS_MODULE; diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index 327372b7a54e..88494149e910 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c @@ -59,7 +59,6 @@ typedef struct user_info_t { #ifdef DEBUG extern int ds_pc_debug; -#define cs_socket_name(skt) ((skt)->dev.class_id) #define ds_dbg(lvl, fmt, arg...) do { \ if (ds_pc_debug >= lvl) \ diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index b9201c2ec38b..0ce39de834c4 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -48,7 +48,6 @@ static u8 pcmcia_used_irq[NR_IRQS]; #ifdef DEBUG extern int ds_pc_debug; -#define cs_socket_name(skt) ((skt)->dev.class_id) #define ds_dbg(skt, lvl, fmt, arg...) do { \ if (ds_pc_debug >= lvl) \ diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c index 360c24896548..dd0ddf19ee57 100644 --- a/drivers/pcmcia/pd6729.c +++ b/drivers/pcmcia/pd6729.c @@ -682,7 +682,7 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, socket[i].socket.ops = &pd6729_operations; socket[i].socket.resource_ops = &pccard_nonstatic_ops; - socket[i].socket.dev.dev = &dev->dev; + socket[i].socket.dev.parent = &dev->dev; socket[i].socket.driver_data = &socket[i]; } diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c index c3176b16b7be..bfcaad6021cf 100644 --- a/drivers/pcmcia/rsrc_nonstatic.c +++ b/drivers/pcmcia/rsrc_nonstatic.c @@ -616,7 +616,7 @@ static int nonstatic_adjust_io_region(struct resource *res, unsigned long r_star static struct resource *nonstatic_find_io_region(unsigned long base, int num, unsigned long align, struct pcmcia_socket *s) { - struct resource *res = make_resource(0, num, IORESOURCE_IO, s->dev.class_id); + struct resource *res = make_resource(0, num, IORESOURCE_IO, s->dev.bus_id); struct socket_data *s_data = s->resource_data; struct pcmcia_align_data data; unsigned long min = base; @@ -650,7 +650,7 @@ static struct resource *nonstatic_find_io_region(unsigned long base, int num, static struct resource * nonstatic_find_mem_region(u_long base, u_long num, u_long align, int low, struct pcmcia_socket *s) { - struct resource *res = make_resource(0, num, IORESOURCE_MEM, s->dev.class_id); + struct resource *res = make_resource(0, num, IORESOURCE_MEM, s->dev.bus_id); struct socket_data *s_data = s->resource_data; struct pcmcia_align_data data; unsigned long min, max; @@ -897,9 +897,10 @@ EXPORT_SYMBOL(pccard_nonstatic_ops); /* sysfs interface to the resource database */ -static ssize_t show_io_db(struct class_device *class_dev, char *buf) +static ssize_t show_io_db(struct device *dev, + struct device_attribute *attr, char *buf) { - struct pcmcia_socket *s = class_get_devdata(class_dev); + struct pcmcia_socket *s = dev_get_drvdata(dev); struct socket_data *data; struct resource_map *p; ssize_t ret = 0; @@ -920,9 +921,11 @@ static ssize_t show_io_db(struct class_device *class_dev, char *buf) return (ret); } -static ssize_t store_io_db(struct class_device *class_dev, const char *buf, size_t count) +static ssize_t store_io_db(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { - struct pcmcia_socket *s = class_get_devdata(class_dev); + struct pcmcia_socket *s = dev_get_drvdata(dev); unsigned long start_addr, end_addr; unsigned int add = ADD_MANAGED_RESOURCE; ssize_t ret = 0; @@ -947,11 +950,12 @@ static ssize_t store_io_db(struct class_device *class_dev, const char *buf, size return ret ? ret : count; } -static CLASS_DEVICE_ATTR(available_resources_io, 0600, show_io_db, store_io_db); +static DEVICE_ATTR(available_resources_io, 0600, show_io_db, store_io_db); -static ssize_t show_mem_db(struct class_device *class_dev, char *buf) +static ssize_t show_mem_db(struct device *dev, + struct device_attribute *attr, char *buf) { - struct pcmcia_socket *s = class_get_devdata(class_dev); + struct pcmcia_socket *s = dev_get_drvdata(dev); struct socket_data *data; struct resource_map *p; ssize_t ret = 0; @@ -972,9 +976,11 @@ static ssize_t show_mem_db(struct class_device *class_dev, char *buf) return (ret); } -static ssize_t store_mem_db(struct class_device *class_dev, const char *buf, size_t count) +static ssize_t store_mem_db(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { - struct pcmcia_socket *s = class_get_devdata(class_dev); + struct pcmcia_socket *s = dev_get_drvdata(dev); unsigned long start_addr, end_addr; unsigned int add = ADD_MANAGED_RESOURCE; ssize_t ret = 0; @@ -999,25 +1005,25 @@ static ssize_t store_mem_db(struct class_device *class_dev, const char *buf, siz return ret ? ret : count; } -static CLASS_DEVICE_ATTR(available_resources_mem, 0600, show_mem_db, store_mem_db); +static DEVICE_ATTR(available_resources_mem, 0600, show_mem_db, store_mem_db); -static struct class_device_attribute *pccard_rsrc_attributes[] = { - &class_device_attr_available_resources_io, - &class_device_attr_available_resources_mem, +static struct device_attribute *pccard_rsrc_attributes[] = { + &dev_attr_available_resources_io, + &dev_attr_available_resources_mem, NULL, }; -static int __devinit pccard_sysfs_add_rsrc(struct class_device *class_dev, +static int __devinit pccard_sysfs_add_rsrc(struct device *dev, struct class_interface *class_intf) { - struct pcmcia_socket *s = class_get_devdata(class_dev); - struct class_device_attribute **attr; + struct pcmcia_socket *s = dev_get_drvdata(dev); + struct device_attribute **attr; int ret = 0; if (s->resource_ops != &pccard_nonstatic_ops) return 0; for (attr = pccard_rsrc_attributes; *attr; attr++) { - ret = class_device_create_file(class_dev, *attr); + ret = device_create_file(dev, *attr); if (ret) break; } @@ -1025,23 +1031,23 @@ static int __devinit pccard_sysfs_add_rsrc(struct class_device *class_dev, return ret; } -static void __devexit pccard_sysfs_remove_rsrc(struct class_device *class_dev, +static void __devexit pccard_sysfs_remove_rsrc(struct device *dev, struct class_interface *class_intf) { - struct pcmcia_socket *s = class_get_devdata(class_dev); - struct class_device_attribute **attr; + struct pcmcia_socket *s = dev_get_drvdata(dev); + struct device_attribute **attr; if (s->resource_ops != &pccard_nonstatic_ops) return; for (attr = pccard_rsrc_attributes; *attr; attr++) - class_device_remove_file(class_dev, *attr); + device_remove_file(dev, *attr); } static struct class_interface pccard_rsrc_interface = { .class = &pcmcia_socket_class, - .add = &pccard_sysfs_add_rsrc, - .remove = __devexit_p(&pccard_sysfs_remove_rsrc), + .add_dev = &pccard_sysfs_add_rsrc, + .remove_dev = __devexit_p(&pccard_sysfs_remove_rsrc), }; static int __init nonstatic_sysfs_init(void) diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c index e433704e026a..d2a3bea55de2 100644 --- a/drivers/pcmcia/soc_common.c +++ b/drivers/pcmcia/soc_common.c @@ -478,10 +478,10 @@ dump_bits(char **p, const char *prefix, unsigned int val, struct bittbl *bits, i * * Returns: the number of characters added to the buffer */ -static ssize_t show_status(struct class_device *class_dev, char *buf) +static ssize_t show_status(struct device *dev, char *buf) { struct soc_pcmcia_socket *skt = - container_of(class_dev, struct soc_pcmcia_socket, socket.dev); + container_of(dev, struct soc_pcmcia_socket, socket.dev); char *p = buf; p+=sprintf(p, "slot : %d\n", skt->nr); @@ -747,7 +747,7 @@ int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops add_timer(&skt->poll_timer); - class_device_create_file(&skt->socket.dev, &class_device_attr_status); + device_create_file(&skt->socket.dev, &device_attr_status); } dev_set_drvdata(dev, sinfo); diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c index b005602d6b53..ea5765c3bdc0 100644 --- a/drivers/pcmcia/socket_sysfs.c +++ b/drivers/pcmcia/socket_sysfs.c @@ -40,7 +40,8 @@ #define to_socket(_dev) container_of(_dev, struct pcmcia_socket, dev) -static ssize_t pccard_show_type(struct class_device *dev, char *buf) +static ssize_t pccard_show_type(struct device *dev, struct device_attribute *attr, + char *buf) { struct pcmcia_socket *s = to_socket(dev); @@ -50,9 +51,10 @@ static ssize_t pccard_show_type(struct class_device *dev, char *buf) return sprintf(buf, "32-bit\n"); return sprintf(buf, "16-bit\n"); } -static CLASS_DEVICE_ATTR(card_type, 0444, pccard_show_type, NULL); +static DEVICE_ATTR(card_type, 0444, pccard_show_type, NULL); -static ssize_t pccard_show_voltage(struct class_device *dev, char *buf) +static ssize_t pccard_show_voltage(struct device *dev, struct device_attribute *attr, + char *buf) { struct pcmcia_socket *s = to_socket(dev); @@ -63,28 +65,31 @@ static ssize_t pccard_show_voltage(struct class_device *dev, char *buf) s->socket.Vcc % 10); return sprintf(buf, "X.XV\n"); } -static CLASS_DEVICE_ATTR(card_voltage, 0444, pccard_show_voltage, NULL); +static DEVICE_ATTR(card_voltage, 0444, pccard_show_voltage, NULL); -static ssize_t pccard_show_vpp(struct class_device *dev, char *buf) +static ssize_t pccard_show_vpp(struct device *dev, struct device_attribute *attr, + char *buf) { struct pcmcia_socket *s = to_socket(dev); if (!(s->state & SOCKET_PRESENT)) return -ENODEV; return sprintf(buf, "%d.%dV\n", s->socket.Vpp / 10, s->socket.Vpp % 10); } -static CLASS_DEVICE_ATTR(card_vpp, 0444, pccard_show_vpp, NULL); +static DEVICE_ATTR(card_vpp, 0444, pccard_show_vpp, NULL); -static ssize_t pccard_show_vcc(struct class_device *dev, char *buf) +static ssize_t pccard_show_vcc(struct device *dev, struct device_attribute *attr, + char *buf) { struct pcmcia_socket *s = to_socket(dev); if (!(s->state & SOCKET_PRESENT)) return -ENODEV; return sprintf(buf, "%d.%dV\n", s->socket.Vcc / 10, s->socket.Vcc % 10); } -static CLASS_DEVICE_ATTR(card_vcc, 0444, pccard_show_vcc, NULL); +static DEVICE_ATTR(card_vcc, 0444, pccard_show_vcc, NULL); -static ssize_t pccard_store_insert(struct class_device *dev, const char *buf, size_t count) +static ssize_t pccard_store_insert(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) { ssize_t ret; struct pcmcia_socket *s = to_socket(dev); @@ -96,16 +101,20 @@ static ssize_t pccard_store_insert(struct class_device *dev, const char *buf, si return ret ? ret : count; } -static CLASS_DEVICE_ATTR(card_insert, 0200, NULL, pccard_store_insert); +static DEVICE_ATTR(card_insert, 0200, NULL, pccard_store_insert); -static ssize_t pccard_show_card_pm_state(struct class_device *dev, char *buf) +static ssize_t pccard_show_card_pm_state(struct device *dev, + struct device_attribute *attr, + char *buf) { struct pcmcia_socket *s = to_socket(dev); return sprintf(buf, "%s\n", s->state & SOCKET_SUSPEND ? "off" : "on"); } -static ssize_t pccard_store_card_pm_state(struct class_device *dev, const char *buf, size_t count) +static ssize_t pccard_store_card_pm_state(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { ssize_t ret = -EINVAL; struct pcmcia_socket *s = to_socket(dev); @@ -120,9 +129,11 @@ static ssize_t pccard_store_card_pm_state(struct class_device *dev, const char * return ret ? -ENODEV : count; } -static CLASS_DEVICE_ATTR(card_pm_state, 0644, pccard_show_card_pm_state, pccard_store_card_pm_state); +static DEVICE_ATTR(card_pm_state, 0644, pccard_show_card_pm_state, pccard_store_card_pm_state); -static ssize_t pccard_store_eject(struct class_device *dev, const char *buf, size_t count) +static ssize_t pccard_store_eject(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { ssize_t ret; struct pcmcia_socket *s = to_socket(dev); @@ -134,16 +145,20 @@ static ssize_t pccard_store_eject(struct class_device *dev, const char *buf, siz return ret ? ret : count; } -static CLASS_DEVICE_ATTR(card_eject, 0200, NULL, pccard_store_eject); +static DEVICE_ATTR(card_eject, 0200, NULL, pccard_store_eject); -static ssize_t pccard_show_irq_mask(struct class_device *dev, char *buf) +static ssize_t pccard_show_irq_mask(struct device *dev, + struct device_attribute *attr, + char *buf) { struct pcmcia_socket *s = to_socket(dev); return sprintf(buf, "0x%04x\n", s->irq_mask); } -static ssize_t pccard_store_irq_mask(struct class_device *dev, const char *buf, size_t count) +static ssize_t pccard_store_irq_mask(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { ssize_t ret; struct pcmcia_socket *s = to_socket(dev); @@ -161,16 +176,19 @@ static ssize_t pccard_store_irq_mask(struct class_device *dev, const char *buf, return ret ? ret : count; } -static CLASS_DEVICE_ATTR(card_irq_mask, 0600, pccard_show_irq_mask, pccard_store_irq_mask); +static DEVICE_ATTR(card_irq_mask, 0600, pccard_show_irq_mask, pccard_store_irq_mask); -static ssize_t pccard_show_resource(struct class_device *dev, char *buf) +static ssize_t pccard_show_resource(struct device *dev, + struct device_attribute *attr, char *buf) { struct pcmcia_socket *s = to_socket(dev); return sprintf(buf, "%s\n", s->resource_setup_done ? "yes" : "no"); } -static ssize_t pccard_store_resource(struct class_device *dev, const char *buf, size_t count) +static ssize_t pccard_store_resource(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { unsigned long flags; struct pcmcia_socket *s = to_socket(dev); @@ -196,7 +214,7 @@ static ssize_t pccard_store_resource(struct class_device *dev, const char *buf, return count; } -static CLASS_DEVICE_ATTR(available_resources_setup_done, 0600, pccard_show_resource, pccard_store_resource); +static DEVICE_ATTR(available_resources_setup_done, 0600, pccard_show_resource, pccard_store_resource); static ssize_t pccard_extract_cis(struct pcmcia_socket *s, char *buf, loff_t off, size_t count) @@ -279,7 +297,7 @@ static ssize_t pccard_show_cis(struct kobject *kobj, char *buf, loff_t off, size if (off + count > size) count = size - off; - s = to_socket(container_of(kobj, struct class_device, kobj)); + s = to_socket(container_of(kobj, struct device, kobj)); if (!(s->state & SOCKET_PRESENT)) return -ENODEV; @@ -296,7 +314,7 @@ static ssize_t pccard_show_cis(struct kobject *kobj, char *buf, loff_t off, size static ssize_t pccard_store_cis(struct kobject *kobj, char *buf, loff_t off, size_t count) { - struct pcmcia_socket *s = to_socket(container_of(kobj, struct class_device, kobj)); + struct pcmcia_socket *s = to_socket(container_of(kobj, struct device, kobj)); cisdump_t *cis; int error; @@ -335,16 +353,16 @@ static ssize_t pccard_store_cis(struct kobject *kobj, char *buf, loff_t off, siz } -static struct class_device_attribute *pccard_socket_attributes[] = { - &class_device_attr_card_type, - &class_device_attr_card_voltage, - &class_device_attr_card_vpp, - &class_device_attr_card_vcc, - &class_device_attr_card_insert, - &class_device_attr_card_pm_state, - &class_device_attr_card_eject, - &class_device_attr_card_irq_mask, - &class_device_attr_available_resources_setup_done, +static struct device_attribute *pccard_socket_attributes[] = { + &dev_attr_card_type, + &dev_attr_card_voltage, + &dev_attr_card_vpp, + &dev_attr_card_vcc, + &dev_attr_card_insert, + &dev_attr_card_pm_state, + &dev_attr_card_eject, + &dev_attr_card_irq_mask, + &dev_attr_available_resources_setup_done, NULL, }; @@ -355,35 +373,35 @@ static struct bin_attribute pccard_cis_attr = { .write = pccard_store_cis, }; -static int __devinit pccard_sysfs_add_socket(struct class_device *class_dev, +static int __devinit pccard_sysfs_add_socket(struct device *dev, struct class_interface *class_intf) { - struct class_device_attribute **attr; + struct device_attribute **attr; int ret = 0; for (attr = pccard_socket_attributes; *attr; attr++) { - ret = class_device_create_file(class_dev, *attr); + ret = device_create_file(dev, *attr); if (ret) break; } if (!ret) - ret = sysfs_create_bin_file(&class_dev->kobj, &pccard_cis_attr); + ret = sysfs_create_bin_file(&dev->kobj, &pccard_cis_attr); return ret; } -static void __devexit pccard_sysfs_remove_socket(struct class_device *class_dev, +static void __devexit pccard_sysfs_remove_socket(struct device *dev, struct class_interface *class_intf) { - struct class_device_attribute **attr; + struct device_attribute **attr; - sysfs_remove_bin_file(&class_dev->kobj, &pccard_cis_attr); + sysfs_remove_bin_file(&dev->kobj, &pccard_cis_attr); for (attr = pccard_socket_attributes; *attr; attr++) - class_device_remove_file(class_dev, *attr); + device_remove_file(dev, *attr); } struct class_interface pccard_sysfs_interface = { .class = &pcmcia_socket_class, - .add = &pccard_sysfs_add_socket, - .remove = __devexit_p(&pccard_sysfs_remove_socket), + .add_dev = &pccard_sysfs_add_socket, + .remove_dev = __devexit_p(&pccard_sysfs_remove_socket), }; diff --git a/drivers/pcmcia/tcic.c b/drivers/pcmcia/tcic.c index 2d2f415f80a8..c158cf38b9dd 100644 --- a/drivers/pcmcia/tcic.c +++ b/drivers/pcmcia/tcic.c @@ -512,7 +512,7 @@ static int __init init_tcic(void) for (i = 0; i < sockets; i++) { socket_table[i].socket.ops = &tcic_operations; socket_table[i].socket.resource_ops = &pccard_nonstatic_ops; - socket_table[i].socket.dev.dev = &tcic_device.dev; + socket_table[i].socket.dev.parent = &tcic_device.dev; ret = pcmcia_register_socket(&socket_table[i].socket); if (ret && i) pcmcia_unregister_socket(&socket_table[0].socket); diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c index da471bddc972..a61d768f6e0e 100644 --- a/drivers/pcmcia/yenta_socket.c +++ b/drivers/pcmcia/yenta_socket.c @@ -1104,7 +1104,7 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i /* prepare pcmcia_socket */ socket->socket.ops = ¥ta_socket_operations; socket->socket.resource_ops = &pccard_nonstatic_ops; - socket->socket.dev.dev = &dev->dev; + socket->socket.dev.parent = &dev->dev; socket->socket.driver_data = socket; socket->socket.owner = THIS_MODULE; socket->socket.features = SS_CAP_PAGE_REGS | SS_CAP_PCCARD; |