[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1040994502.402858.1346361031972.JavaMail.root@mail.savoirfairelinux.com>
Date: Thu, 30 Aug 2012 17:10:32 -0400 (EDT)
From: Vivien Didelot <vivien.didelot@...oirfairelinux.com>
To: Guenter Roeck <linux@...ck-us.net>
Cc: lm-sensors@...sensors.org, Jean Delvare <khali@...ux-fr.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] hwmon: add Maxim MAX197 support
Hi Guenter,
Thanks for your detailed comments. I'll send a new version soon.
About the following comment, I agree with you. However as there is no convention for this case, for now I would prefer to stick with the model as seen in drivers such as sht15.
In the future, I think we could add a field in the platform_data, something like .chip = "max199", or .variant = 199, and update the hwmon drivers.
Thanks,
Vivien
> +static int __devexit max197_remove(struct platform_device *pdev)
> +{
> + struct max197_chip *chip = platform_get_drvdata(pdev);
> +
> + hwmon_device_unregister(chip->hwmon_dev);
> + sysfs_remove_group(&pdev->dev.kobj, &max197_sysfs_group);
> +
> + return 0;
> +}
> +
> +static struct platform_driver __refdata maxim_drivers[] = {
> + {
> + .driver = {
> + .name = "max197",
> + .owner = THIS_MODULE,
> + },
> + .probe = max197_probe,
> + .remove = __devexit_p(max197_remove),
> + }, {
> + .driver = {
> + .name = "max199",
> + .owner = THIS_MODULE,
> + },
> + .probe = max197_probe,
> + .remove = __devexit_p(max197_remove),
> + }
> +};
> +
> +static int __init max197_init(void)
> +{
> + int ret;
> + int i;
> +
> + for (i = 0; i < ARRAY_SIZE(maxim_drivers); i++) {
> + ret = platform_driver_register(&maxim_drivers[i]);
> + if (ret)
> + goto error_unregister;
> + }
I keep thinking about this; there must be a better way where we only need one
platform driver instance. After all, there is just one driver, only there can
be multiple devices. No idea how to do that right now, though. If I find out,
I'll let you know.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists