lkml.org 
[lkml]   [2012]   [Aug]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.


\
 
 \ /
  Last update: 2012-08-30 23:41    [W:0.192 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site