* [PATCH 1/2] usb: gadget: udc: atmel: check rc of devm_gpiod_get_optional()
@ 2022-07-05 13:19 Michael Walle
2022-07-05 13:19 ` [PATCH 2/2] usb: gadget: udc: atmel: convert to platform driver Michael Walle
2022-07-05 18:53 ` [PATCH 1/2] usb: gadget: udc: atmel: check rc of devm_gpiod_get_optional() Saravana Kannan
0 siblings, 2 replies; 5+ messages in thread
From: Michael Walle @ 2022-07-05 13:19 UTC (permalink / raw)
To: Cristian Birsan, Felipe Balbi, Greg Kroah-Hartman, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea
Cc: Saravana Kannan, linux-arm-kernel, linux-usb, linux-kernel,
Michael Walle
devm_gpiod_get_optional() might still return an error code, esp.
EPROBE_DEFER. Return any errors.
Signed-off-by: Michael Walle <michael@walle.cc>
---
drivers/usb/gadget/udc/atmel_usba_udc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index ae2bfbac603e..48355e0cee76 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -2165,6 +2165,8 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev,
udc->vbus_pin = devm_gpiod_get_optional(&pdev->dev, "atmel,vbus",
GPIOD_IN);
+ if (IS_ERR(udc->vbus_pin))
+ return ERR_CAST(udc->vbus_pin);
if (fifo_mode == 0) {
udc->num_ep = udc_config->num_ep;
--
2.30.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] usb: gadget: udc: atmel: convert to platform driver
2022-07-05 13:19 [PATCH 1/2] usb: gadget: udc: atmel: check rc of devm_gpiod_get_optional() Michael Walle
@ 2022-07-05 13:19 ` Michael Walle
2022-07-05 18:53 ` [PATCH 1/2] usb: gadget: udc: atmel: check rc of devm_gpiod_get_optional() Saravana Kannan
1 sibling, 0 replies; 5+ messages in thread
From: Michael Walle @ 2022-07-05 13:19 UTC (permalink / raw)
To: Cristian Birsan, Felipe Balbi, Greg Kroah-Hartman, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea
Cc: Saravana Kannan, linux-arm-kernel, linux-usb, linux-kernel,
Michael Walle
The driver won't probe on a LAN9668 because the pinctrl driver isn't
ready yet. Probe deferral is not supported because the init section
is already discarded. With fw_devlink enabled, the probe won't even
be called. Convert the driver to a proper platform driver.
Signed-off-by: Michael Walle <michael@walle.cc>
---
drivers/usb/gadget/udc/atmel_usba_udc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 48355e0cee76..53ca38c4b3ec 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -2060,7 +2060,7 @@ static const struct usba_udc_errata at91sam9g45_errata = {
.pulse_bias = at91sam9g45_pulse_bias,
};
-static const struct usba_ep_config ep_config_sam9[] __initconst = {
+static const struct usba_ep_config ep_config_sam9[] = {
{ .nr_banks = 1 }, /* ep 0 */
{ .nr_banks = 2, .can_dma = 1, .can_isoc = 1 }, /* ep 1 */
{ .nr_banks = 2, .can_dma = 1, .can_isoc = 1 }, /* ep 2 */
@@ -2070,7 +2070,7 @@ static const struct usba_ep_config ep_config_sam9[] __initconst = {
{ .nr_banks = 3, .can_dma = 1, .can_isoc = 1 }, /* ep 6 */
};
-static const struct usba_ep_config ep_config_sama5[] __initconst = {
+static const struct usba_ep_config ep_config_sama5[] = {
{ .nr_banks = 1 }, /* ep 0 */
{ .nr_banks = 3, .can_dma = 1, .can_isoc = 1 }, /* ep 1 */
{ .nr_banks = 3, .can_dma = 1, .can_isoc = 1 }, /* ep 2 */
@@ -2449,6 +2449,7 @@ static int usba_udc_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(usba_udc_pm_ops, usba_udc_suspend, usba_udc_resume);
static struct platform_driver udc_driver = {
+ .probe = usba_udc_probe,
.remove = usba_udc_remove,
.driver = {
.name = "atmel_usba_udc",
@@ -2456,8 +2457,7 @@ static struct platform_driver udc_driver = {
.of_match_table = atmel_udc_dt_ids,
},
};
-
-module_platform_driver_probe(udc_driver, usba_udc_probe);
+module_platform_driver(udc_driver);
MODULE_DESCRIPTION("Atmel USBA UDC driver");
MODULE_AUTHOR("Haavard Skinnemoen (Atmel)");
--
2.30.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] usb: gadget: udc: atmel: check rc of devm_gpiod_get_optional()
2022-07-05 13:19 [PATCH 1/2] usb: gadget: udc: atmel: check rc of devm_gpiod_get_optional() Michael Walle
2022-07-05 13:19 ` [PATCH 2/2] usb: gadget: udc: atmel: convert to platform driver Michael Walle
@ 2022-07-05 18:53 ` Saravana Kannan
2022-07-05 20:56 ` Michael Walle
1 sibling, 1 reply; 5+ messages in thread
From: Saravana Kannan @ 2022-07-05 18:53 UTC (permalink / raw)
To: Michael Walle
Cc: Cristian Birsan, Felipe Balbi, Greg Kroah-Hartman, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea, linux-arm-kernel, linux-usb,
linux-kernel
On Tue, Jul 5, 2022 at 6:19 AM Michael Walle <michael@walle.cc> wrote:
>
> devm_gpiod_get_optional() might still return an error code, esp.
> EPROBE_DEFER. Return any errors.
>
> Signed-off-by: Michael Walle <michael@walle.cc>
> ---
> drivers/usb/gadget/udc/atmel_usba_udc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
> index ae2bfbac603e..48355e0cee76 100644
> --- a/drivers/usb/gadget/udc/atmel_usba_udc.c
> +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
> @@ -2165,6 +2165,8 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev,
>
> udc->vbus_pin = devm_gpiod_get_optional(&pdev->dev, "atmel,vbus",
> GPIOD_IN);
> + if (IS_ERR(udc->vbus_pin))
> + return ERR_CAST(udc->vbus_pin);
I'm confused. Is it really an optional resource if you treat a failure to get it
as a reason to fail a probe?
-Saravana
>
> if (fifo_mode == 0) {
> udc->num_ep = udc_config->num_ep;
> --
> 2.30.2
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] usb: gadget: udc: atmel: check rc of devm_gpiod_get_optional()
2022-07-05 18:53 ` [PATCH 1/2] usb: gadget: udc: atmel: check rc of devm_gpiod_get_optional() Saravana Kannan
@ 2022-07-05 20:56 ` Michael Walle
2022-07-06 2:24 ` Saravana Kannan
0 siblings, 1 reply; 5+ messages in thread
From: Michael Walle @ 2022-07-05 20:56 UTC (permalink / raw)
To: Saravana Kannan
Cc: Cristian Birsan, Felipe Balbi, Greg Kroah-Hartman, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea, linux-arm-kernel, linux-usb,
linux-kernel
Am 2022-07-05 20:53, schrieb Saravana Kannan:
> On Tue, Jul 5, 2022 at 6:19 AM Michael Walle <michael@walle.cc> wrote:
>>
>> devm_gpiod_get_optional() might still return an error code, esp.
>> EPROBE_DEFER. Return any errors.
>>
>> Signed-off-by: Michael Walle <michael@walle.cc>
>> ---
>> drivers/usb/gadget/udc/atmel_usba_udc.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c
>> b/drivers/usb/gadget/udc/atmel_usba_udc.c
>> index ae2bfbac603e..48355e0cee76 100644
>> --- a/drivers/usb/gadget/udc/atmel_usba_udc.c
>> +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
>> @@ -2165,6 +2165,8 @@ static struct usba_ep * atmel_udc_of_init(struct
>> platform_device *pdev,
>>
>> udc->vbus_pin = devm_gpiod_get_optional(&pdev->dev,
>> "atmel,vbus",
>> GPIOD_IN);
>> + if (IS_ERR(udc->vbus_pin))
>> + return ERR_CAST(udc->vbus_pin);
>
> I'm confused. Is it really an optional resource if you treat a failure
> to get it
> as a reason to fail a probe?
If the gpio isn't found NULL is returned.
-michael
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] usb: gadget: udc: atmel: check rc of devm_gpiod_get_optional()
2022-07-05 20:56 ` Michael Walle
@ 2022-07-06 2:24 ` Saravana Kannan
0 siblings, 0 replies; 5+ messages in thread
From: Saravana Kannan @ 2022-07-06 2:24 UTC (permalink / raw)
To: Michael Walle
Cc: Cristian Birsan, Felipe Balbi, Greg Kroah-Hartman, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea, linux-arm-kernel, linux-usb,
linux-kernel
On Tue, Jul 5, 2022 at 1:56 PM Michael Walle <michael@walle.cc> wrote:
>
> Am 2022-07-05 20:53, schrieb Saravana Kannan:
> > On Tue, Jul 5, 2022 at 6:19 AM Michael Walle <michael@walle.cc> wrote:
> >>
> >> devm_gpiod_get_optional() might still return an error code, esp.
> >> EPROBE_DEFER. Return any errors.
> >>
> >> Signed-off-by: Michael Walle <michael@walle.cc>
> >> ---
> >> drivers/usb/gadget/udc/atmel_usba_udc.c | 2 ++
> >> 1 file changed, 2 insertions(+)
> >>
> >> diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c
> >> b/drivers/usb/gadget/udc/atmel_usba_udc.c
> >> index ae2bfbac603e..48355e0cee76 100644
> >> --- a/drivers/usb/gadget/udc/atmel_usba_udc.c
> >> +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
> >> @@ -2165,6 +2165,8 @@ static struct usba_ep * atmel_udc_of_init(struct
> >> platform_device *pdev,
> >>
> >> udc->vbus_pin = devm_gpiod_get_optional(&pdev->dev,
> >> "atmel,vbus",
> >> GPIOD_IN);
> >> + if (IS_ERR(udc->vbus_pin))
> >> + return ERR_CAST(udc->vbus_pin);
> >
> > I'm confused. Is it really an optional resource if you treat a failure
> > to get it
> > as a reason to fail a probe?
>
> If the gpio isn't found NULL is returned.
Ah, ok.
-Saravana
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-07-06 2:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-05 13:19 [PATCH 1/2] usb: gadget: udc: atmel: check rc of devm_gpiod_get_optional() Michael Walle
2022-07-05 13:19 ` [PATCH 2/2] usb: gadget: udc: atmel: convert to platform driver Michael Walle
2022-07-05 18:53 ` [PATCH 1/2] usb: gadget: udc: atmel: check rc of devm_gpiod_get_optional() Saravana Kannan
2022-07-05 20:56 ` Michael Walle
2022-07-06 2:24 ` Saravana Kannan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).