RE: [PATCH v2] Input: ad7879: support auxiliary GPIOs via gpiolib

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From: Dmitry Torokhov [mailto:dmitry.torokhov@xxxxxxxxx]
>
>Hi Mike,
>
>On Tue, Jan 12, 2010 at 04:04:57PM -0500, Mike Frysinger wrote:
>> +
>> +		err = gpiochip_add(&ts->gc);
>> +		if (err)
>> +			dev_err(&bus->dev, "failed to register gpio
%d\n",
>> +				ts->gc.base);
>> +	}
>
>So if it fails here...
>
>> +	struct ad7879_platform_data *pdata = bus->dev.platform_data;
>> +	if (pdata->gpio_export) {
>> +		if (gpiochip_remove(&ts->gc))
>> +			dev_err(&bus->dev, "failed to remove gpio %d\n",
>> +				ts->gc.base);
>
>... how valid is it to remove it here?

Right - I should use a flag to sense whether the gpiochip was added or
not.

>
>Also, could you stub out
>ad7879_gptiochip_export/ad7879_gptiochip_unexport
>in case of !CONFIG_GPIOLIB?

Can you explain - where do you see those?


>
>> +	}
>> +#endif
>> +
>>  	ad7879_disable(ts);
>>  	sysfs_remove_group(&ts->bus->dev.kobj, &ad7879_attr_group);
>>  	free_irq(ts->bus->irq, ts);
>> diff --git a/include/linux/spi/ad7879.h b/include/linux/spi/ad7879.h
>> index 4231104..7231eab 100644
>> --- a/include/linux/spi/ad7879.h
>> +++ b/include/linux/spi/ad7879.h
>> @@ -28,8 +28,12 @@ struct ad7879_platform_data {
>>  	 * 1 = 4, 2 = 8, 3 = 16 (median > averaging)
>>  	 */
>>  	u8	median;
>> -	/* 1 = AUX/VBAT/GPIO set to GPIO Output */
>> -	u8	gpio_output;
>> -	/* Initial GPIO pin state (valid if gpio_output = 1) */
>> -	u8	gpio_default;
>> +	/* 1 = AUX/VBAT/GPIO export GPIO to gpiolib
>> +	 * requires CONFIG_GPIOLIB
>> +	 */
>> +	u8	gpio_export;
>
>And make this a bool while you are at it.
>
>Thanks!
>
>--
>Dmitry

-Michael
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux