Re: [PATCH v2 1/3] Input: imx_keypad - Add device tree support

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

 



2013/1/3 Shawn Guo <shawn.guo@xxxxxxxxxx>:
> On Tue, Jan 01, 2013 at 11:21:13AM +0800, Liu Ying wrote:
>> +#ifdef CONFIG_OF
>> +static inline int imx_keypad_check_dt(struct platform_device *pdev)
>> +{
>> +     struct device_node *np = pdev->dev.of_node;
>> +
>> +     if (!np)
>> +             return -ENODEV;
>> +
>> +     return 0;
>> +}
>> +#else
>> +static inline int imx_keypad_check_dt(struct platform_device *pdev)
>> +{
>> +     return -ENODEV;
>> +}
>> +#endif
>> +
>>  static int imx_keypad_probe(struct platform_device *pdev)
>>  {
>>       const struct matrix_keymap_data *keymap_data = pdev->dev.platform_data;
>>       struct imx_keypad *keypad;
>>       struct input_dev *input_dev;
>>       struct resource *res;
>> -     int irq, error, i;
>> +     int irq, error, i, row, col, row_shift;
>>
>> -     if (keymap_data == NULL) {
>> +     if (keymap_data == NULL && imx_keypad_check_dt(pdev)) {
>
> Shouldn't the following just equally work?
>
>         if (keymap_data == NULL && pdev->dev.of_node == NULL) {
>
> Shawn
Yes, it looks better. I will do the change. Thanks.
>
>>               dev_err(&pdev->dev, "no keymap defined\n");
>>               return -EINVAL;
>>       }
>



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


[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux