Re: [PATCH] Haptic class support (v2)

From: Kay Sievers
Date: Tue Oct 13 2009 - 12:48:15 EST


On Tue, Oct 6, 2009 at 09:45, Kyungmin Park <kmpark@xxxxxxxxxxxxx> wrote:

> +/**
> + * haptic_classdev_register - register a new object of haptic_classdev class.
> + * @dev: The device to register.
> + * @haptic_cdev: the haptic_classdev structure for this device.
> + */
> +int haptic_classdev_register(struct device *parent,
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â struct haptic_classdev *haptic_cdev)
> +{
> + Â Â Â int ret;
> +
> + Â Â Â haptic_cdev->dev = device_create(haptic_class, parent, 0,
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â haptic_cdev, "%s", haptic_cdev->name);
> + Â Â Â if (IS_ERR(haptic_cdev->dev))
> + Â Â Â Â Â Â Â return PTR_ERR(haptic_cdev->dev);
> +
> + Â Â Â /* register the attributes */
> + Â Â Â ret = class_create_file(haptic_class, &class_attr_enable);
> + Â Â Â if (ret) {
> + Â Â Â Â Â Â Â printk(KERN_ERR "%s: class_create_file(enable) failed\n",
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â__func__);
> + Â Â Â Â Â Â Â return ret;
> + Â Â Â }

As mentioned in an earlier mail, this needs some explanation. What are
you doing here? Creating a device below a class, and then add a bunch
of attributes to the class itself, instead of the device you created?

All calls to class_create_file() need to go, we can not allow any new
users of this broken interface. As mentioned, if you need
subsystem-wide attributes you need to use a bus and not a class,
classes are flat and can not handle such things properly.

Thanks,
Kay
--
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/