From 72735c0ed4bf667b0ac4605abbd3c6dd6073afa1 Mon Sep 17 00:00:00 2001 From: Trilok Soni Date: Fri, 2 Mar 2007 03:56:10 -0800 Subject: [PATCH] ARM: OMAP: convert dsp driver to use struct device Converts from using "class_device" to "struct device". Signed-off-by: Trilok Soni Signed-off-by: Tony Lindgren --- arch/arm/plat-omap/dsp/dsp_ctl_core.c | 10 +++++----- arch/arm/plat-omap/dsp/task.c | 8 ++++---- arch/arm/plat-omap/mailbox.c | 26 ++++++++++++++------------ include/asm-arm/arch-omap/mailbox.h | 2 +- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/arch/arm/plat-omap/dsp/dsp_ctl_core.c b/arch/arm/plat-omap/dsp/dsp_ctl_core.c index 04420df0476..d17a5c86f6a 100644 --- a/arch/arm/plat-omap/dsp/dsp_ctl_core.c +++ b/arch/arm/plat-omap/dsp/dsp_ctl_core.c @@ -107,10 +107,10 @@ int __init dsp_ctl_core_init(void) dsp_ctl_class = class_create(THIS_MODULE, "dspctl"); for (i = 0; i < ARRAY_SIZE(dev_list); i++) { - class_device_create(dsp_ctl_class, NULL, + device_create(dsp_ctl_class, NULL, MKDEV(OMAP_DSP_CTL_MAJOR, dev_list[i].minor), - NULL, dev_list[i].devname); + dev_list[i].devname); } return 0; @@ -121,9 +121,9 @@ void dsp_ctl_core_exit(void) int i; for (i = 0; i < ARRAY_SIZE(dev_list); i++) { - class_device_destroy(dsp_ctl_class, - MKDEV(OMAP_DSP_CTL_MAJOR, - dev_list[i].minor)); + device_destroy(dsp_ctl_class, + MKDEV(OMAP_DSP_CTL_MAJOR, + dev_list[i].minor)); } class_destroy(dsp_ctl_class); diff --git a/arch/arm/plat-omap/dsp/task.c b/arch/arm/plat-omap/dsp/task.c index 807c40835dc..10eee909805 100644 --- a/arch/arm/plat-omap/dsp/task.c +++ b/arch/arm/plat-omap/dsp/task.c @@ -1821,9 +1821,9 @@ static int taskdev_init(struct taskdev *dev, char *name, unsigned char minor) ret |= device_create_file(&dev->dev, &dev_attr_proc_list); if (ret) printk(KERN_ERR "device_create_file failed: %d\n", ret); - class_device_create(dsp_task_class, NULL, - MKDEV(OMAP_DSP_TASK_MAJOR, minor), - NULL, "dsptask%d", minor); + device_create(dsp_task_class, NULL, + MKDEV(OMAP_DSP_TASK_MAJOR, minor), + "dsptask%d", minor); init_waitqueue_head(&dev->state_wait_q); init_rwsem(&dev->state_sem); @@ -1840,7 +1840,7 @@ static void taskdev_delete(unsigned char minor) device_remove_file(&dev->dev, &dev_attr_devname); device_remove_file(&dev->dev, &dev_attr_devstate); device_remove_file(&dev->dev, &dev_attr_proc_list); - class_device_destroy(dsp_task_class, MKDEV(OMAP_DSP_TASK_MAJOR, minor)); + device_destroy(dsp_task_class, MKDEV(OMAP_DSP_TASK_MAJOR, minor)); device_unregister(&dev->dev); proc_list_flush(&dev->proc_list_lock, &dev->proc_list); taskdev[minor] = NULL; diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c index ab71d53d0bd..c194c328bdd 100644 --- a/arch/arm/plat-omap/mailbox.c +++ b/arch/arm/plat-omap/mailbox.c @@ -178,12 +178,13 @@ static irqreturn_t mbox_interrupt(int irq, void *p) /* * sysfs files */ -static ssize_t mbox_attr_write(struct class_device *dev, const char *buf, - size_t count) +static ssize_t mbox_attr_write(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { int ret; mbox_msg_t msg; - struct omap_mbox *mbox = class_get_devdata(dev); + struct omap_mbox *mbox = dev_get_drvdata(dev); msg = (mbox_msg_t) simple_strtoul(buf, NULL, 16); @@ -194,14 +195,15 @@ static ssize_t mbox_attr_write(struct class_device *dev, const char *buf, return count; } -static ssize_t mbox_attr_read(struct class_device *dev, char *buf) +static ssize_t mbox_attr_read(struct device *dev, struct device_attribute *attr, + char *buf) { - struct omap_mbox *mbox = class_get_devdata(dev); + struct omap_mbox *mbox = dev_get_drvdata(dev); return sprintf(buf, mbox->name); } -static CLASS_DEVICE_ATTR(mbox, S_IALLUGO, mbox_attr_read, mbox_attr_write); +static DEVICE_ATTR(mbox, S_IALLUGO, mbox_attr_read, mbox_attr_write); static ssize_t mbox_show(struct class *class, char *buf) { @@ -224,18 +226,18 @@ static int omap_mbox_init(struct omap_mbox *mbox) return ret; } - mbox->class_dev.class = &omap_mbox_class; - strlcpy(mbox->class_dev.class_id, mbox->name, KOBJ_NAME_LEN); - class_set_devdata(&mbox->class_dev, mbox); + mbox->dev.class = &omap_mbox_class; + strlcpy(mbox->dev.bus_id, mbox->name, KOBJ_NAME_LEN); + dev_set_drvdata(&mbox->dev, mbox); - ret = class_device_register(&mbox->class_dev); + ret = device_register(&mbox->dev); if (unlikely(ret)) return ret; - ret = class_device_create_file(&mbox->class_dev, &class_device_attr_mbox); + ret = device_create_file(&mbox->dev, &dev_attr_mbox); if (unlikely(ret)) { printk(KERN_ERR - "class_device_create_file failed: %d\n", ret); + "device_create_file failed: %d\n", ret); goto fail1; } diff --git a/include/asm-arm/arch-omap/mailbox.h b/include/asm-arm/arch-omap/mailbox.h index 66669f07b95..87395ea58b2 100644 --- a/include/asm-arm/arch-omap/mailbox.h +++ b/include/asm-arm/arch-omap/mailbox.h @@ -51,7 +51,7 @@ struct omap_mbox { mbox_msg_t seq_snd, seq_rcv; - struct class_device class_dev; + struct device dev; void *priv; -- 2.41.1