Commit 958fb2d8 authored by Toshihiro Kobayashi's avatar Toshihiro Kobayashi Committed by Tony Lindgren

[PATCH] ARM: OMAP: Updated DSP to use class_device instead of class_simple

Updated DSP to use class_device instead of class_simple
parent eb7cfc49
...@@ -42,7 +42,8 @@ ...@@ -42,7 +42,8 @@
#include "dsp.h" #include "dsp.h"
#include "ipbuf.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); static struct device_attribute dev_attr_loadinfo = __ATTR_RO(loadinfo);
extern struct device_attribute dev_attr_ipbuf; extern struct device_attribute dev_attr_ipbuf;
...@@ -754,7 +755,8 @@ void mbx1_getvar(struct mbcmd *mb) ...@@ -754,7 +755,8 @@ void mbx1_getvar(struct mbcmd *mb)
/* /*
* sysfs files * 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; int len = 0;
...@@ -778,7 +780,8 @@ static ssize_t ifver_show(struct device *dev, char *buf) ...@@ -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 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 0
if (dsp_is_ready()) { if (dsp_is_ready()) {
...@@ -795,7 +798,8 @@ static ssize_t icrmask_show(struct device *dev, char *buf) ...@@ -795,7 +798,8 @@ static ssize_t icrmask_show(struct device *dev, char *buf)
return sprintf(buf, "0x%04x\n", dsp_icrmask); 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; int ret;
...@@ -816,7 +820,8 @@ static ssize_t icrmask_store(struct device *dev, const char *buf, size_t count) ...@@ -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 = static struct device_attribute dev_attr_icrmask =
__ATTR(icrmask, S_IWUSR | S_IRUGO, icrmask_show, icrmask_store); __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 len;
int ret; int ret;
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#define TWCH_MINOR 2 #define TWCH_MINOR 2
#define ERR_MINOR 3 #define ERR_MINOR 3
static struct class_simple *dsp_ctl_class; static struct class *dsp_ctl_class;
extern struct file_operations dsp_ctl_fops, extern struct file_operations dsp_ctl_fops,
dsp_mem_fops, dsp_mem_fops,
dsp_twch_fops, dsp_twch_fops,
...@@ -98,13 +98,13 @@ int __init dsp_ctl_core_init(void) ...@@ -98,13 +98,13 @@ int __init dsp_ctl_core_init(void)
return retval; return retval;
} }
dsp_ctl_class = class_simple_create(THIS_MODULE, "dspctl"); dsp_ctl_class = class_create(THIS_MODULE, "dspctl");
devfs_mk_dir("dspctl"); devfs_mk_dir("dspctl");
for (i = 0; i < ARRAY_SIZE(dev_list); i++) { for (i = 0; i < ARRAY_SIZE(dev_list); i++) {
class_simple_device_add(dsp_ctl_class, class_device_create(dsp_ctl_class,
MKDEV(OMAP_DSP_CTL_MAJOR, MKDEV(OMAP_DSP_CTL_MAJOR,
dev_list[i].minor), dev_list[i].minor),
NULL, dev_list[i].devname); NULL, dev_list[i].devname);
devfs_mk_cdev(MKDEV(OMAP_DSP_CTL_MAJOR, dev_list[i].minor), devfs_mk_cdev(MKDEV(OMAP_DSP_CTL_MAJOR, dev_list[i].minor),
S_IFCHR | dev_list[i].mode, S_IFCHR | dev_list[i].mode,
dev_list[i].devfs_name); dev_list[i].devfs_name);
...@@ -119,11 +119,12 @@ void dsp_ctl_core_exit(void) ...@@ -119,11 +119,12 @@ void dsp_ctl_core_exit(void)
for (i = 0; i < ARRAY_SIZE(dev_list); i++) { for (i = 0; i < ARRAY_SIZE(dev_list); i++) {
devfs_remove(dev_list[i].devfs_name); devfs_remove(dev_list[i].devfs_name);
class_simple_device_remove(MKDEV(OMAP_DSP_CTL_MAJOR, class_device_destroy(dsp_ctl_class,
dev_list[i].minor)); MKDEV(OMAP_DSP_CTL_MAJOR,
dev_list[i].minor));
} }
devfs_remove("dspctl"); devfs_remove("dspctl");
class_simple_destroy(dsp_ctl_class); class_destroy(dsp_ctl_class);
unregister_chrdev(OMAP_DSP_CTL_MAJOR, "dspctl"); unregister_chrdev(OMAP_DSP_CTL_MAJOR, "dspctl");
} }
...@@ -1340,7 +1340,8 @@ static int dsp_mem_release(struct inode *inode, struct file *file) ...@@ -1340,7 +1340,8 @@ static int dsp_mem_release(struct inode *inode, struct file *file)
/* /*
* sysfs files * 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 len;
int lbase, victim; int lbase, victim;
...@@ -1405,7 +1406,8 @@ static ssize_t mmu_show(struct device *dev, char *buf) ...@@ -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 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 len;
int i; int i;
......
...@@ -234,7 +234,8 @@ void mbx1_err_ipbfull(void) ...@@ -234,7 +234,8 @@ void mbx1_err_ipbfull(void)
/* /*
* sysfs files * 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; int len = 0;
unsigned short bid; unsigned short bid;
......
...@@ -165,7 +165,8 @@ void mblog_add(struct mbcmd *mb, enum mblog_dir dir) ...@@ -165,7 +165,8 @@ void mblog_add(struct mbcmd *mb, enum mblog_dir dir)
/* /*
* sysfs file * 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 len = 0;
int wp; int wp;
......
...@@ -148,17 +148,28 @@ static void taskdev_delete(unsigned char minor); ...@@ -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_attach_task(struct taskdev *dev, struct dsptask *task);
static void taskdev_detach_task(struct taskdev *dev); static void taskdev_detach_task(struct taskdev *dev);
static ssize_t devname_show(struct device *d, char *buf); static ssize_t devname_show(struct device *d, struct device_attribute *attr,
static ssize_t devstate_show(struct device *d, char *buf); char *buf);
static ssize_t proc_list_show(struct device *d, char *buf); static ssize_t devstate_show(struct device *d, struct device_attribute *attr,
static ssize_t taskname_show(struct device *d, char *buf); char *buf);
static ssize_t ttyp_show(struct device *d, char *buf); static ssize_t proc_list_show(struct device *d, struct device_attribute *attr,
static ssize_t fifosz_show(struct device *d, char *buf); char *buf);
static int fifosz_store(struct device *d, const char *buf, size_t count); static ssize_t taskname_show(struct device *d, struct device_attribute *attr,
static ssize_t fifocnt_show(struct device *d, char *buf); char *buf);
static ssize_t ipblink_show(struct device *d, char *buf); static ssize_t ttyp_show(struct device *d, struct device_attribute *attr,
static ssize_t wsz_show(struct device *d, char *buf); char *buf);
static ssize_t mmap_show(struct device *d, 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_devname = __ATTR_RO(devname);
static struct device_attribute dev_attr_devstate = __ATTR_RO(devstate); static struct device_attribute dev_attr_devstate = __ATTR_RO(devstate);
...@@ -176,7 +187,7 @@ static struct bus_type dsptask_bus = { ...@@ -176,7 +187,7 @@ static struct bus_type dsptask_bus = {
.name = "dsptask", .name = "dsptask",
}; };
static struct class_simple *dsp_task_class; static struct class *dsp_task_class;
static struct taskdev *taskdev[TASKDEV_MAX]; static struct taskdev *taskdev[TASKDEV_MAX];
static struct dsptask *dsptask[TASKDEV_MAX]; static struct dsptask *dsptask[TASKDEV_MAX];
static DECLARE_MUTEX(cfg_sem); static DECLARE_MUTEX(cfg_sem);
...@@ -1681,9 +1692,8 @@ static int taskdev_init(struct taskdev *dev, char *name, unsigned char minor) ...@@ -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_devname);
device_create_file(&dev->dev, &dev_attr_devstate); device_create_file(&dev->dev, &dev_attr_devstate);
device_create_file(&dev->dev, &dev_attr_proc_list); device_create_file(&dev->dev, &dev_attr_proc_list);
class_simple_device_add(dsp_task_class, class_device_create(dsp_task_class, MKDEV(OMAP_DSP_TASK_MAJOR, minor),
MKDEV(OMAP_DSP_TASK_MAJOR, minor), NULL, NULL, "dsptask%d", minor);
"dsptask%d", minor);
devfs_mk_cdev(MKDEV(OMAP_DSP_TASK_MAJOR, minor), devfs_mk_cdev(MKDEV(OMAP_DSP_TASK_MAJOR, minor),
S_IFCHR | S_IRUGO | S_IWUGO, "dsptask%d", minor); S_IFCHR | S_IRUGO | S_IWUGO, "dsptask%d", minor);
...@@ -1703,6 +1713,7 @@ static void taskdev_delete(unsigned char 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_devstate);
device_remove_file(&dev->dev, &dev_attr_proc_list); 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); devfs_remove("dsptask%d", minor);
device_unregister(&dev->dev); device_unregister(&dev->dev);
proc_list_flush(&dev->proc_list); proc_list_flush(&dev->proc_list);
...@@ -2416,7 +2427,8 @@ void mbx1_dbg(struct mbcmd *mb) ...@@ -2416,7 +2427,8 @@ void mbx1_dbg(struct mbcmd *mb)
/* /*
* sysfs files * 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); struct taskdev *dev = to_taskdev(d);
return sprintf(buf, "%s\n", dev->name); return sprintf(buf, "%s\n", dev->name);
...@@ -2433,13 +2445,15 @@ static ssize_t devname_show(struct device *d, char *buf) ...@@ -2433,13 +2445,15 @@ static ssize_t devname_show(struct device *d, char *buf)
((stat) == OMAP_DSP_DEVSTATE_ADDFAIL) ? "ADDFAIL" :\ ((stat) == OMAP_DSP_DEVSTATE_ADDFAIL) ? "ADDFAIL" :\
"unknown") "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); struct taskdev *dev = to_taskdev(d);
return sprintf(buf, "%s\n", devstate_name(dev->state)); 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 taskdev *dev;
struct proc_list *pl; struct proc_list *pl;
...@@ -2455,7 +2469,8 @@ static ssize_t proc_list_show(struct device *d, char *buf) ...@@ -2455,7 +2469,8 @@ static ssize_t proc_list_show(struct device *d, char *buf)
return len; 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); struct taskdev *dev = to_taskdev(d);
int len; int len;
...@@ -2465,7 +2480,8 @@ static ssize_t taskname_show(struct device *d, char *buf) ...@@ -2465,7 +2480,8 @@ static ssize_t taskname_show(struct device *d, char *buf)
return len; 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; unsigned short ttyp = to_taskdev(d)->task->ttyp;
int len = 0; int len = 0;
...@@ -2487,13 +2503,15 @@ static ssize_t ttyp_show(struct device *d, char *buf) ...@@ -2487,13 +2503,15 @@ static ssize_t ttyp_show(struct device *d, char *buf)
return len; 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; struct fifo_struct *fifo = &to_taskdev(d)->task->rcvdt.fifo;
return sprintf(buf, "%d\n", fifo->sz); 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; struct dsptask *task = to_taskdev(d)->task;
unsigned long fifosz; unsigned long fifosz;
...@@ -2505,7 +2523,8 @@ static int fifosz_store(struct device *d, const char *buf, size_t count) ...@@ -2505,7 +2523,8 @@ static int fifosz_store(struct device *d, const char *buf, size_t count)
return (ret < 0) ? ret : strlen(buf); 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; struct fifo_struct *fifo = &to_taskdev(d)->task->rcvdt.fifo;
return sprintf(buf, "%d\n", fifo->cnt); return sprintf(buf, "%d\n", fifo->cnt);
...@@ -2526,7 +2545,8 @@ static __inline__ char *bid_name(unsigned short bid) ...@@ -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; struct rcvdt_bk_struct *rcvdt = &to_taskdev(d)->task->rcvdt.bk;
int len; int len;
...@@ -2539,12 +2559,14 @@ static ssize_t ipblink_show(struct device *d, char *buf) ...@@ -2539,12 +2559,14 @@ static ssize_t ipblink_show(struct device *d, char *buf)
return len; 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); 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; struct dsptask *task = to_taskdev(d)->task;
return sprintf(buf, "0x%p 0x%x\n", task->map_base, task->map_length); return sprintf(buf, "0x%p 0x%x\n", task->map_base, task->map_length);
...@@ -2599,7 +2621,7 @@ int __init dsp_taskmod_init(void) ...@@ -2599,7 +2621,7 @@ int __init dsp_taskmod_init(void)
unregister_chrdev(OMAP_DSP_TASK_MAJOR, "dsptask"); unregister_chrdev(OMAP_DSP_TASK_MAJOR, "dsptask");
return -EINVAL; return -EINVAL;
} }
dsp_task_class = class_simple_create(THIS_MODULE, "dsptask"); dsp_task_class = class_create(THIS_MODULE, "dsptask");
devfs_mk_dir("dsptask"); devfs_mk_dir("dsptask");
return 0; return 0;
...@@ -2608,7 +2630,7 @@ int __init dsp_taskmod_init(void) ...@@ -2608,7 +2630,7 @@ int __init dsp_taskmod_init(void)
void dsp_taskmod_exit(void) void dsp_taskmod_exit(void)
{ {
devfs_remove("dsptask"); devfs_remove("dsptask");
class_simple_destroy(dsp_task_class); class_destroy(dsp_task_class);
driver_unregister(&dsptask_driver); driver_unregister(&dsptask_driver);
bus_unregister(&dsptask_bus); bus_unregister(&dsptask_bus);
unregister_chrdev(OMAP_DSP_TASK_MAJOR, "dsptask"); unregister_chrdev(OMAP_DSP_TASK_MAJOR, "dsptask");
......
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