[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140523175312.GI22111@sirena.org.uk>
Date: Fri, 23 May 2014 18:53:12 +0100
From: Mark Brown <broonie@...nel.org>
To: "Zhu, Lejun" <lejun.zhu@...ux.intel.com>
Cc: lee.jones@...aro.org, sameo@...ux.intel.com,
linux-kernel@...r.kernel.org, jacob.jun.pan@...ux.intel.com,
bin.yang@...el.com
Subject: Re: [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().
Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)
Powered by blists - more mailing lists