Re: [PATCH RESEND v2 2/4] mfd: intel_soc_pmic: I2C interface
From: Mark Brown
Date: Fri May 23 2014 - 13:54:04 EST
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().
Attachment:
signature.asc
Description: Digital signature