[PATCH v2 08/09] input: enable touch on 88pm860x

Dmitry Torokhov dmitry.torokhov at gmail.com
Wed Dec 9 22:57:26 EST 2009


On Wednesday 09 December 2009 07:21:49 pm Dmitry Torokhov wrote:
> > +
> > +static int __devinit pm860x_touch_probe(struct platform_device *pdev)
> > +{
> > +	struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent);
> > +	struct pm860x_platform_data *pm860x_pdata;
> > +	struct pm860x_touch_pdata *pdata;
> > +	struct pm860x_touch *touch;
> > +	int irq, ret;
> > +
> > +	irq = platform_get_irq(pdev, 0);
> > +	if (irq < 0) {
> > +		dev_err(&pdev->dev, "No IRQ resource!\n");
> > +		return -EINVAL;
> > +	}
> > +
> > +	if (pdev->dev.parent->platform_data) {
> > +		pm860x_pdata = pdev->dev.parent->platform_data;
> > +		pdata = pm860x_pdata->touch;
> > +	} else
> > +		pdata = NULL;
> > +
> > +	if (pdata == NULL) {
> > +		dev_err(&pdev->dev, "platform data isn't assigned to "
> > +			"touch\n");
> > +		return -EINVAL;
> > +	}
> 
> This should be written as:
> 
> ...
> 	struct pm860x_platform_data *pm860x_pdata =
>  pdev->dev.parent->platform_data; ...
> 
> 	if (pm860x_pdata) {
> 		pdata = pm860x_pdata->touch;
> 		if (!pdata) {
> 			dev_err(&pdev->dev,
> 				"touchscreen platform data is missing\n");
> 			return -EINVAL;
> 		}
> 	}

Ugh, sorry, it was pure garbage... long day for me...

	if (!pm860x_pdata) {
		dev_err(&pdev->dev, "platform data is missing\n");
		return -EINVAL;
	}

	pdata = pm860x_pdata->touch;
	if (!pdata) {
		dev_err(&pdev->dev, "touchscreen data is missing\n");
		return -EINVAL;
	}
 
should be better.

Sorry for the confusion.

-- 
Dmitry



More information about the linux-arm-kernel mailing list