Re: [PATCH] sysdev: remove global sysdev drivers list

From: Cornelia Huck
Date: Mon Aug 13 2007 - 08:53:20 EST


On Sun, 12 Aug 2007 13:44:07 +0900,
Akinobu Mita <akinobu.mita@xxxxxxxxx> wrote:

> No one uses sysdev_drivers. Because no one calls sysdev_driver_register
> with NULL class.
>
> And it is difficult to imagine that someone want to implement a global
> sysdev driver which is called with all sys_device on any kind of
> sysdev_class.
>
> So this patch removes global sysdev_drivers list.

This makes sense, I guess, especially since it simplyfies the code.

Some minor comments below.

> @@ -182,10 +179,12 @@ int sysdev_driver_register(struct sysdev
> list_for_each_entry(dev, &cls->kset.list, kobj.entry)
> drv->add(dev);
> }
> - } else
> - list_add_tail(&drv->entry, &sysdev_drivers);
> + } else {
> + err = -EINVAL;
> + WARN_ON(1);

Maybe print what went wrong here?

> + }
> mutex_unlock(&sysdev_drivers_lock);
> - return 0;
> + return err;
> }
>
>
> @@ -206,6 +205,8 @@ void sysdev_driver_unregister(struct sys
> drv->remove(dev);
> }
> kset_put(&cls->kset);
> + } else {
> + WARN_ON(1);

This one is redundant, since you already warned on register.

> }
> mutex_unlock(&sysdev_drivers_lock);
> }

> @@ -320,12 +310,6 @@ void sysdev_shutdown(void)
> struct sysdev_driver * drv;
> pr_debug(" %s\n", kobject_name(&sysdev->kobj));
>
> - /* Call global drivers first. */
> - list_for_each_entry(drv, &sysdev_drivers, entry) {
> - if (drv->shutdown)
> - drv->shutdown(sysdev);
> - }
> -
> /* Call auxillary drivers next. */

This comment has become meaningless.

> list_for_each_entry(drv, &cls->drivers, entry) {
> if (drv->shutdown)

> @@ -393,15 +371,6 @@ int sysdev_suspend(pm_message_t state)
> list_for_each_entry(sysdev, &cls->kset.list, kobj.entry) {
> pr_debug(" %s\n", kobject_name(&sysdev->kobj));
>
> - /* Call global drivers first. */
> - list_for_each_entry(drv, &sysdev_drivers, entry) {
> - if (drv->suspend) {
> - ret = drv->suspend(sysdev, state);
> - if (ret)
> - goto gbl_driver;
> - }
> - }
> -
> /* Call auxillary drivers next. */

Dito here.

> list_for_each_entry(drv, &cls->drivers, entry) {
> if (drv->suspend) {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/