lkml.org 
[lkml]   [2014]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH RESEND v2 2/4] mfd: intel_soc_pmic: I2C interface
On Fri, May 23, 2014 at 08:40:27AM +0800, Zhu, Lejun wrote:

> +static int pmic_i2c_lookup_gpio(struct device *dev, int acpi_index)
> +{
> + struct gpio_desc *desc;
> + int gpio;
> +
> + desc = gpiod_get_index(dev, KBUILD_MODNAME, acpi_index);
> + if (IS_ERR(desc))
> + return PTR_ERR(desc);
> +
> + gpio = desc_to_gpio(desc);
> +
> + gpiod_put(desc);
> +
> + return gpio;
> +}

Why not just have the driver work with the gpiod API, is there any real
need to convert to a GPIO number?

> +static const struct i2c_device_id pmic_i2c_id[] = {
> + { "crystal_cove", (kernel_ulong_t)&crystal_cove_pmic},
> + { "INT33FD", (kernel_ulong_t)&crystal_cove_pmic},
> + { "INT33FD:00", (kernel_ulong_t)&crystal_cove_pmic},
> + { }
> +};
> +MODULE_DEVICE_TABLE(i2c, pmic_i2c_id);

The INT33FD ones here look like they should only be in the ACPI table.

> +static int __init pmic_i2c_init(void)
> +{
> + int ret;
> +
> + ret = i2c_add_driver(&pmic_i2c_driver);
> + if (ret != 0)
> + pr_err("Failed to register pmic I2C driver: %d\n", ret);
> +
> + return ret;
> +}
> +subsys_initcall(pmic_i2c_init);

module_i2c_driver() - you shouldn't need subsys_initcall().
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2014-05-23 20:41    [W:0.102 / U:0.472 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site