Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 337946
b: refs/heads/master
c: a588da1
h: refs/heads/master
v: v3
  • Loading branch information
Ian Abbott authored and Greg Kroah-Hartman committed Nov 15, 2012
1 parent e2fc153 commit 9d4f49f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 28 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: af448aca8fa41789aec8a968a56ed0868c803a2b
refs/heads/master: a588da1d5aac72801df0c83075225a6074c81ac5
37 changes: 10 additions & 27 deletions trunk/drivers/staging/comedi/drivers.c
Original file line number Diff line number Diff line change
Expand Up @@ -833,12 +833,8 @@ void comedi_reset_async_buf(struct comedi_async *async)
async->events = 0;
}

static int
comedi_auto_config_helper(struct device *hardware_device,
struct comedi_driver *driver,
int (*attach_wrapper) (struct comedi_device *,
unsigned long),
unsigned long context)
int comedi_auto_config(struct device *hardware_device,
struct comedi_driver *driver, unsigned long context)
{
int minor;
struct comedi_device_file_info *dev_file_info;
Expand All @@ -848,6 +844,13 @@ comedi_auto_config_helper(struct device *hardware_device,
if (!comedi_autoconfig)
return 0;

if (!driver->auto_attach) {
dev_warn(hardware_device,
"BUG! comedi driver '%s' has no auto_attach handler\n",
driver->driver_name);
return -EINVAL;
}

minor = comedi_alloc_board_minor(hardware_device);
if (minor < 0)
return minor;
Expand All @@ -862,9 +865,8 @@ comedi_auto_config_helper(struct device *hardware_device,
ret = -EIO;
else {
comedi_set_hw_dev(comedi_dev, hardware_device);
/* set comedi_dev->driver here for attach wrapper */
comedi_dev->driver = driver;
ret = (*attach_wrapper)(comedi_dev, context);
ret = driver->auto_attach(comedi_dev, context);
if (ret < 0) {
module_put(driver->module);
__comedi_device_detach(comedi_dev);
Expand All @@ -878,25 +880,6 @@ comedi_auto_config_helper(struct device *hardware_device,
comedi_free_board_minor(minor);
return ret;
}

static int comedi_auto_config_wrapper(struct comedi_device *dev,
unsigned long context)
{
if (!dev->driver->auto_attach) {
dev_warn(dev->class_dev,
"BUG! driver '%s' has no auto_attach handler\n",
dev->driver->driver_name);
return -EINVAL;
}
return dev->driver->auto_attach(dev, context);
}

int comedi_auto_config(struct device *hardware_device,
struct comedi_driver *driver, unsigned long context)
{
return comedi_auto_config_helper(hardware_device, driver,
comedi_auto_config_wrapper, context);
}
EXPORT_SYMBOL_GPL(comedi_auto_config);

void comedi_auto_unconfig(struct device *hardware_device)
Expand Down

0 comments on commit 9d4f49f

Please sign in to comment.