From 958fb2d8fefc7222693af56400f1f6e0783c4eb3 Mon Sep 17 00:00:00 2001 From: Toshihiro Kobayashi Date: Thu, 30 Jun 2005 06:20:40 -0700 Subject: [PATCH] [PATCH] ARM: OMAP: Updated DSP to use class_device instead of class_simple Updated DSP to use class_device instead of class_simple --- arch/arm/mach-omap/dsp/dsp_ctl.c | 15 ++++-- arch/arm/mach-omap/dsp/dsp_ctl_core.c | 19 +++---- arch/arm/mach-omap/dsp/dsp_mem.c | 6 ++- arch/arm/mach-omap/dsp/ipbuf.c | 3 +- arch/arm/mach-omap/dsp/mblog.c | 3 +- arch/arm/mach-omap/dsp/task.c | 78 +++++++++++++++++---------- 6 files changed, 78 insertions(+), 46 deletions(-) diff --git a/arch/arm/mach-omap/dsp/dsp_ctl.c b/arch/arm/mach-omap/dsp/dsp_ctl.c index f9fe7c6a475..985b852a8fd 100644 --- a/arch/arm/mach-omap/dsp/dsp_ctl.c +++ b/arch/arm/mach-omap/dsp/dsp_ctl.c @@ -42,7 +42,8 @@ #include "dsp.h" #include "ipbuf.h" -static ssize_t loadinfo_show(struct device *dev, char *buf); +static ssize_t loadinfo_show(struct device *dev, struct device_attribute *attr, + char *buf); static struct device_attribute dev_attr_loadinfo = __ATTR_RO(loadinfo); extern struct device_attribute dev_attr_ipbuf; @@ -754,7 +755,8 @@ void mbx1_getvar(struct mbcmd *mb) /* * sysfs files */ -static ssize_t ifver_show(struct device *dev, char *buf) +static ssize_t ifver_show(struct device *dev, struct device_attribute *attr, + char *buf) { int len = 0; @@ -778,7 +780,8 @@ static ssize_t ifver_show(struct device *dev, char *buf) static struct device_attribute dev_attr_ifver = __ATTR_RO(ifver); -static ssize_t icrmask_show(struct device *dev, char *buf) +static ssize_t icrmask_show(struct device *dev, struct device_attribute *attr, + char *buf) { #if 0 if (dsp_is_ready()) { @@ -795,7 +798,8 @@ static ssize_t icrmask_show(struct device *dev, char *buf) return sprintf(buf, "0x%04x\n", dsp_icrmask); } -static ssize_t icrmask_store(struct device *dev, const char *buf, size_t count) +static ssize_t icrmask_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) { int ret; @@ -816,7 +820,8 @@ static ssize_t icrmask_store(struct device *dev, const char *buf, size_t count) static struct device_attribute dev_attr_icrmask = __ATTR(icrmask, S_IWUSR | S_IRUGO, icrmask_show, icrmask_store); -static ssize_t loadinfo_show(struct device *dev, char *buf) +static ssize_t loadinfo_show(struct device *dev, struct device_attribute *attr, + char *buf) { int len; int ret; diff --git a/arch/arm/mach-omap/dsp/dsp_ctl_core.c b/arch/arm/mach-omap/dsp/dsp_ctl_core.c index 729ad9fcf0b..88df7cbba4b 100644 --- a/arch/arm/mach-omap/dsp/dsp_ctl_core.c +++ b/arch/arm/mach-omap/dsp/dsp_ctl_core.c @@ -38,7 +38,7 @@ #define TWCH_MINOR 2 #define ERR_MINOR 3 -static struct class_simple *dsp_ctl_class; +static struct class *dsp_ctl_class; extern struct file_operations dsp_ctl_fops, dsp_mem_fops, dsp_twch_fops, @@ -98,13 +98,13 @@ int __init dsp_ctl_core_init(void) return retval; } - dsp_ctl_class = class_simple_create(THIS_MODULE, "dspctl"); + dsp_ctl_class = class_create(THIS_MODULE, "dspctl"); devfs_mk_dir("dspctl"); for (i = 0; i < ARRAY_SIZE(dev_list); i++) { - class_simple_device_add(dsp_ctl_class, - MKDEV(OMAP_DSP_CTL_MAJOR, - dev_list[i].minor), - NULL, dev_list[i].devname); + class_device_create(dsp_ctl_class, + MKDEV(OMAP_DSP_CTL_MAJOR, + dev_list[i].minor), + NULL, dev_list[i].devname); devfs_mk_cdev(MKDEV(OMAP_DSP_CTL_MAJOR, dev_list[i].minor), S_IFCHR | dev_list[i].mode, dev_list[i].devfs_name); @@ -119,11 +119,12 @@ void dsp_ctl_core_exit(void) for (i = 0; i < ARRAY_SIZE(dev_list); i++) { devfs_remove(dev_list[i].devfs_name); - class_simple_device_remove(MKDEV(OMAP_DSP_CTL_MAJOR, - dev_list[i].minor)); + class_device_destroy(dsp_ctl_class, + MKDEV(OMAP_DSP_CTL_MAJOR, + dev_list[i].minor)); } devfs_remove("dspctl"); - class_simple_destroy(dsp_ctl_class); + class_destroy(dsp_ctl_class); unregister_chrdev(OMAP_DSP_CTL_MAJOR, "dspctl"); } diff --git a/arch/arm/mach-omap/dsp/dsp_mem.c b/arch/arm/mach-omap/dsp/dsp_mem.c index 107417941c2..972e54c52cb 100644 --- a/arch/arm/mach-omap/dsp/dsp_mem.c +++ b/arch/arm/mach-omap/dsp/dsp_mem.c @@ -1340,7 +1340,8 @@ static int dsp_mem_release(struct inode *inode, struct file *file) /* * sysfs files */ -static ssize_t mmu_show(struct device *dev, char *buf) +static ssize_t mmu_show(struct device *dev, struct device_attribute *attr, + char *buf) { int len; int lbase, victim; @@ -1405,7 +1406,8 @@ static ssize_t mmu_show(struct device *dev, char *buf) static struct device_attribute dev_attr_mmu = __ATTR_RO(mmu); -static ssize_t exmap_show(struct device *dev, char *buf) +static ssize_t exmap_show(struct device *dev, struct device_attribute *attr, + char *buf) { int len; int i; diff --git a/arch/arm/mach-omap/dsp/ipbuf.c b/arch/arm/mach-omap/dsp/ipbuf.c index 9926dadc0b6..305ce689172 100644 --- a/arch/arm/mach-omap/dsp/ipbuf.c +++ b/arch/arm/mach-omap/dsp/ipbuf.c @@ -234,7 +234,8 @@ void mbx1_err_ipbfull(void) /* * sysfs files */ -static ssize_t ipbuf_show(struct device *dev, char *buf) +static ssize_t ipbuf_show(struct device *dev, struct device_attribute *attr, + char *buf) { int len = 0; unsigned short bid; diff --git a/arch/arm/mach-omap/dsp/mblog.c b/arch/arm/mach-omap/dsp/mblog.c index 3671c436c54..69d42c82f20 100644 --- a/arch/arm/mach-omap/dsp/mblog.c +++ b/arch/arm/mach-omap/dsp/mblog.c @@ -165,7 +165,8 @@ void mblog_add(struct mbcmd *mb, enum mblog_dir dir) /* * sysfs file */ -static ssize_t mblog_show(struct device *dev, char *buf) +static ssize_t mblog_show(struct device *dev, struct device_attribute *attr, + char *buf) { int len = 0; int wp; diff --git a/arch/arm/mach-omap/dsp/task.c b/arch/arm/mach-omap/dsp/task.c index 118f1a974cf..fe028a09e8f 100644 --- a/arch/arm/mach-omap/dsp/task.c +++ b/arch/arm/mach-omap/dsp/task.c @@ -148,17 +148,28 @@ static void taskdev_delete(unsigned char minor); static void taskdev_attach_task(struct taskdev *dev, struct dsptask *task); static void taskdev_detach_task(struct taskdev *dev); -static ssize_t devname_show(struct device *d, char *buf); -static ssize_t devstate_show(struct device *d, char *buf); -static ssize_t proc_list_show(struct device *d, char *buf); -static ssize_t taskname_show(struct device *d, char *buf); -static ssize_t ttyp_show(struct device *d, char *buf); -static ssize_t fifosz_show(struct device *d, char *buf); -static int fifosz_store(struct device *d, const char *buf, size_t count); -static ssize_t fifocnt_show(struct device *d, char *buf); -static ssize_t ipblink_show(struct device *d, char *buf); -static ssize_t wsz_show(struct device *d, char *buf); -static ssize_t mmap_show(struct device *d, char *buf); +static ssize_t devname_show(struct device *d, struct device_attribute *attr, + char *buf); +static ssize_t devstate_show(struct device *d, struct device_attribute *attr, + char *buf); +static ssize_t proc_list_show(struct device *d, struct device_attribute *attr, + char *buf); +static ssize_t taskname_show(struct device *d, struct device_attribute *attr, + char *buf); +static ssize_t ttyp_show(struct device *d, struct device_attribute *attr, + char *buf); +static ssize_t fifosz_show(struct device *d, struct device_attribute *attr, + char *buf); +static int fifosz_store(struct device *d, struct device_attribute *attr, + const char *buf, size_t count); +static ssize_t fifocnt_show(struct device *d, struct device_attribute *attr, + char *buf); +static ssize_t ipblink_show(struct device *d, struct device_attribute *attr, + char *buf); +static ssize_t wsz_show(struct device *d, struct device_attribute *attr, + char *buf); +static ssize_t mmap_show(struct device *d, struct device_attribute *attr, + char *buf); static struct device_attribute dev_attr_devname = __ATTR_RO(devname); static struct device_attribute dev_attr_devstate = __ATTR_RO(devstate); @@ -176,7 +187,7 @@ static struct bus_type dsptask_bus = { .name = "dsptask", }; -static struct class_simple *dsp_task_class; +static struct class *dsp_task_class; static struct taskdev *taskdev[TASKDEV_MAX]; static struct dsptask *dsptask[TASKDEV_MAX]; static DECLARE_MUTEX(cfg_sem); @@ -1681,9 +1692,8 @@ static int taskdev_init(struct taskdev *dev, char *name, unsigned char minor) device_create_file(&dev->dev, &dev_attr_devname); device_create_file(&dev->dev, &dev_attr_devstate); device_create_file(&dev->dev, &dev_attr_proc_list); - class_simple_device_add(dsp_task_class, - MKDEV(OMAP_DSP_TASK_MAJOR, minor), NULL, - "dsptask%d", minor); + class_device_create(dsp_task_class, MKDEV(OMAP_DSP_TASK_MAJOR, minor), + NULL, "dsptask%d", minor); devfs_mk_cdev(MKDEV(OMAP_DSP_TASK_MAJOR, minor), S_IFCHR | S_IRUGO | S_IWUGO, "dsptask%d", minor); @@ -1703,6 +1713,7 @@ static void taskdev_delete(unsigned char minor) 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)); devfs_remove("dsptask%d", minor); device_unregister(&dev->dev); proc_list_flush(&dev->proc_list); @@ -2416,7 +2427,8 @@ void mbx1_dbg(struct mbcmd *mb) /* * sysfs files */ -static ssize_t devname_show(struct device *d, char *buf) +static ssize_t devname_show(struct device *d, struct device_attribute *attr, + char *buf) { struct taskdev *dev = to_taskdev(d); return sprintf(buf, "%s\n", dev->name); @@ -2433,13 +2445,15 @@ static ssize_t devname_show(struct device *d, char *buf) ((stat) == OMAP_DSP_DEVSTATE_ADDFAIL) ? "ADDFAIL" :\ "unknown") -static ssize_t devstate_show(struct device *d, char *buf) +static ssize_t devstate_show(struct device *d, struct device_attribute *attr, + char *buf) { struct taskdev *dev = to_taskdev(d); return sprintf(buf, "%s\n", devstate_name(dev->state)); } -static ssize_t proc_list_show(struct device *d, char *buf) +static ssize_t proc_list_show(struct device *d, struct device_attribute *attr, + char *buf) { struct taskdev *dev; struct proc_list *pl; @@ -2455,7 +2469,8 @@ static ssize_t proc_list_show(struct device *d, char *buf) return len; } -static ssize_t taskname_show(struct device *d, char *buf) +static ssize_t taskname_show(struct device *d, struct device_attribute *attr, + char *buf) { struct taskdev *dev = to_taskdev(d); int len; @@ -2465,7 +2480,8 @@ static ssize_t taskname_show(struct device *d, char *buf) return len; } -static ssize_t ttyp_show(struct device *d, char *buf) +static ssize_t ttyp_show(struct device *d, struct device_attribute *attr, + char *buf) { unsigned short ttyp = to_taskdev(d)->task->ttyp; int len = 0; @@ -2487,13 +2503,15 @@ static ssize_t ttyp_show(struct device *d, char *buf) return len; } -static ssize_t fifosz_show(struct device *d, char *buf) +static ssize_t fifosz_show(struct device *d, struct device_attribute *attr, + char *buf) { struct fifo_struct *fifo = &to_taskdev(d)->task->rcvdt.fifo; return sprintf(buf, "%d\n", fifo->sz); } -static int fifosz_store(struct device *d, const char *buf, size_t count) +static int fifosz_store(struct device *d, struct device_attribute *attr, + const char *buf, size_t count) { struct dsptask *task = to_taskdev(d)->task; unsigned long fifosz; @@ -2505,7 +2523,8 @@ static int fifosz_store(struct device *d, const char *buf, size_t count) return (ret < 0) ? ret : strlen(buf); } -static ssize_t fifocnt_show(struct device *d, char *buf) +static ssize_t fifocnt_show(struct device *d, struct device_attribute *attr, + char *buf) { struct fifo_struct *fifo = &to_taskdev(d)->task->rcvdt.fifo; return sprintf(buf, "%d\n", fifo->cnt); @@ -2526,7 +2545,8 @@ static __inline__ char *bid_name(unsigned short bid) } } -static ssize_t ipblink_show(struct device *d, char *buf) +static ssize_t ipblink_show(struct device *d, struct device_attribute *attr, + char *buf) { struct rcvdt_bk_struct *rcvdt = &to_taskdev(d)->task->rcvdt.bk; int len; @@ -2539,12 +2559,14 @@ static ssize_t ipblink_show(struct device *d, char *buf) return len; } -static ssize_t wsz_show(struct device *d, char *buf) +static ssize_t wsz_show(struct device *d, struct device_attribute *attr, + char *buf) { return sprintf(buf, "%d\n", to_taskdev(d)->task->wsz); } -static ssize_t mmap_show(struct device *d, char *buf) +static ssize_t mmap_show(struct device *d, struct device_attribute *attr, + char *buf) { struct dsptask *task = to_taskdev(d)->task; return sprintf(buf, "0x%p 0x%x\n", task->map_base, task->map_length); @@ -2599,7 +2621,7 @@ int __init dsp_taskmod_init(void) unregister_chrdev(OMAP_DSP_TASK_MAJOR, "dsptask"); return -EINVAL; } - dsp_task_class = class_simple_create(THIS_MODULE, "dsptask"); + dsp_task_class = class_create(THIS_MODULE, "dsptask"); devfs_mk_dir("dsptask"); return 0; @@ -2608,7 +2630,7 @@ int __init dsp_taskmod_init(void) void dsp_taskmod_exit(void) { devfs_remove("dsptask"); - class_simple_destroy(dsp_task_class); + class_destroy(dsp_task_class); driver_unregister(&dsptask_driver); bus_unregister(&dsptask_bus); unregister_chrdev(OMAP_DSP_TASK_MAJOR, "dsptask"); -- 2.41.1