Re: [PATCH v6 08/18] mfd: twl6040: Add initial support

Felipe Balbi
2011-07-04T12:53:42Z

[-- Attachment #1: Type: text/plain, Size: 1746 bytes --]

hi,

On Tue, Jun 21, 2011 at 04:39:06PM +0300, Peter Ujfalusi wrote:
> +static int __devinit twl6040_probe(struct platform_device *pdev)
> +{
> + struct twl4030_audio_data *pdata = pdev->dev.platform_data;
> + struct twl6040 *twl6040;
> + struct mfd_cell *cell = NULL;
> + int ret, children = 0;
> +
> + if (!pdata) {
> + dev_err(&pdev->dev, "Platform data is missing\n");
> + return -EINVAL;
> + }
> +
> + twl6040 = kzalloc(sizeof(struct twl6040), GFP_KERNEL);
> + if (!twl6040)
> + return -ENOMEM;
> +
> + platform_set_drvdata(pdev, twl6040);
> +
> + twl6040_dev = pdev;
> + twl6040->dev = &pdev->dev;
> + twl6040->audpwron = pdata->audpwron_gpio;
> + twl6040->irq = pdata->naudint_irq;
> + twl6040->irq_base = pdata->irq_base;
> +
> + mutex_init(&twl6040->mutex);
> + mutex_init(&twl6040->io_mutex);
> + init_completion(&twl6040->ready);
> +
> + twl6040->rev = twl6040_reg_read(twl6040, TWL6040_REG_ASICREV);
> +
> + if (gpio_is_valid(twl6040->audpwron)) {
> + ret = gpio_request(twl6040->audpwron, "audpwron");
> + if (ret)
> + goto gpio1_err;
> +
> + ret = gpio_direction_output(twl6040->audpwron, 0);
> + if (ret)
> + goto gpio2_err;
> + }
> +
> + /* ERRATA: Automatic power-up is not possible in ES1.0 */
> + if (twl6040_get_rev(twl6040) == TWL6040_REV_ES1_0)
> + twl6040->audpwron = -EINVAL;
> +
> + if (twl6040->irq) {
> + /* codec interrupt */
> + ret = twl6040_irq_init(twl6040);
> + if (ret)
> + goto gpio2_err;
> +
> + ret = twl6040_request_irq(twl6040, TWL6040_IRQ_READY,
> + twl6040_naudint_handler, 0,
> + "twl6040_irq_ready", twl6040);

why don't you use the normal request_threaded_irq() ?? This is a bit of
obfuscation IMO.

--
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]