[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <386ac0cf-cee7-bc1b-d22c-80dedff391cf@huawei.com>
Date: Mon, 4 Mar 2019 10:35:13 +0800
From: Chen Yu <chenyu56@...wei.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
CC: <liuyu712@...ilicon.com>, USB <linux-usb@...r.kernel.org>,
devicetree <devicetree@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
John Stultz <john.stultz@...aro.org>,
Suzhuangluan <suzhuangluan@...ilicon.com>,
Kongfei <kongfei@...ilicon.com>, <wanghu17@...ilicon.com>,
<butao@...ilicon.com>, Yao Chen <chenyao11@...wei.com>,
<fangshengzhou@...ilicon.com>, <lipengcheng8@...wei.com>,
songxiaowei <songxiaowei@...ilicon.com>,
xu yiping <xuyiping@...ilicon.com>, <xuyoujun4@...wei.com>,
<yudongbin@...ilicon.com>, <zangleigang@...ilicon.com>,
Chunfeng Yun <chunfeng.yun@...iatek.com>,
"Arnd Bergmann" <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Binghui Wang <wangbinghui@...ilicon.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>
Subject: Re: [PATCH v3 10/12] hikey960: Support usb functionality of Hikey960
Hi Andy,
On 2019/3/3 0:01, Andy Shevchenko wrote:
> On Sat, Mar 2, 2019 at 11:05 AM Yu Chen <chenyu56@...wei.com> wrote:
>>
>> This driver handles usb hub power on and typeC port event of HiKey960 board:
>> 1)DP&DM switching between usb hub and typeC port base on typeC port
>> state
>> 2)Control power of usb hub on Hikey960
>> 3)Control vbus of typeC port
>
>> +config HISI_HIKEY_USB
>> + tristate "USB functionality of HiSilicon Hikey Platform"
>> + depends on OF && GPIOLIB
>> + help
>> + If you say yes here you get support for usb functionality of HiSilicon Hikey Platform.
>
>> +#include <linux/of.h>
>
> It's hard to see why this have
> depends on OF followed by above header inclusion.
>
This driver depends on devicetree, so I add "depends on OF".
But is seems that "#include <linux/of.h>" can be removed after "of_" API
have been removed. Thanks for your reminder!
>> + hisi_hikey_usb->typec_vbus = devm_gpiod_get(dev, "typec-vbus",
>> + GPIOD_OUT_LOW);
>
>> + if (!hisi_hikey_usb->typec_vbus)
>> + return -ENOENT;
>
> Hmm... Is it possible to get NULL pointer from gpiod_get() at all?
>
>> + if (!hisi_hikey_usb->otg_switch)
>> + return -ENOENT;
>
> Ditto.
>
I check the comments of devm_gpio_get API, it will not return NULL pointer.
But is it more safe to keep the NULL checking? What is your advice?
>> + /* hub-vdd33-en is optional */
>> + hisi_hikey_usb->hub_vbus = devm_gpiod_get(dev, "hub-vdd33-en",
>> + GPIOD_OUT_HIGH);
>
> devm_gpio_get_optional() if it's indeed optional.
>
OK.Thanks!
>> + hisi_hikey_usb->role_sw = usb_role_switch_get(dev);
>> + if (!hisi_hikey_usb->role_sw)
>> + return -EPROBE_DEFER;
>
>> + else if (IS_ERR(hisi_hikey_usb->role_sw))
>
> Redundant 'else'
>
OK.
>> + return PTR_ERR(hisi_hikey_usb->role_sw);
>
>> +static const struct of_device_id id_table_hisi_hikey_usb[] = {
>> + {.compatible = "hisilicon,gpio_hubv1"},
>> + {.compatible = "hisilicon,hikey960_usb"},
>> + {}
>> +};
>
> MODULE_DEVICE_TABLE()?
>
OK.
Thanks
Yu Chen
Powered by blists - more mailing lists