Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1526467

Re: [v5,1/5] USB: ohci: da8xx: use ohci priv data instead of globals

From Axel Haslam <ahaslam@baylibre.com>
Newsgroups linux.kernel
Subject Re: [v5,1/5] USB: ohci: da8xx: use ohci priv data instead of globals
Date 2016-11-21 10:10 +0100
Message-ID <sFSLT-7Fl-19@gated-at.bofh.it> (permalink)
References <sDqK6-8gf-33@gated-at.bofh.it> <sFqwh-57f-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sun, Nov 20, 2016 at 3:58 AM, David Lechner <david@lechnology.com> wrote:
> On 11/14/2016 08:40 AM, ahaslam@baylibre.com wrote:
>>
>> Instead of global variables, use the extra_priv_size of
>> the ohci driver.
>>
>> We cannot yet move the ocic mask because this is used on
>> the interrupt handler which is registerded through platform
>> data and does not have an hcd pointer. This will be moved
>> on a later patch.
>>
>> Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
>> ---
>>  drivers/usb/host/ohci-da8xx.c | 73
>> +++++++++++++++++++++++++------------------
>>  1 file changed, 43 insertions(+), 30 deletions(-)
>>
>> diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c
>> index b3de8bc..438970b 100644
>> --- a/drivers/usb/host/ohci-da8xx.c
>> +++ b/drivers/usb/host/ohci-da8xx.c
>
> ...
>>
>> @@ -238,25 +246,29 @@ static int ohci_da8xx_probe(struct platform_device
>> *pdev)
>>         if (hub == NULL)
>>                 return -ENODEV;
>>
>> -       usb11_clk = devm_clk_get(&pdev->dev, "usb11");
>> -       if (IS_ERR(usb11_clk)) {
>> -               if (PTR_ERR(usb11_clk) != -EPROBE_DEFER)
>> +       hcd = usb_create_hcd(&ohci_da8xx_hc_driver, &pdev->dev,
>> +                               dev_name(&pdev->dev));
>> +       if (!hcd)
>> +               return -ENOMEM;
>> +
>> +       da8xx_ohci = to_da8xx_ohci(hcd);
>> +
>> +       da8xx_ohci->usb11_clk = devm_clk_get(&pdev->dev, "usb11");
>> +       if (IS_ERR(da8xx_ohci->usb11_clk)) {
>> +               if (PTR_ERR(da8xx_ohci->usb11_clk) != -EPROBE_DEFER)
>>                         dev_err(&pdev->dev, "Failed to get clock.\n");
>> -               return PTR_ERR(usb11_clk);
>> +               error = PTR_ERR(da8xx_ohci->usb11_clk);
>> +               goto err;
>>         }
>
>
> Small thing, but this could be written slightly cleaner as:
>
>         da8xx_ohci->usb11_clk = devm_clk_get(&pdev->dev, "usb11");
>         if (IS_ERR(da8xx_ohci->usb11_clk)) {
>                 error = PTR_ERR(da8xx_ohci->usb11_clk);
>                 if (error != -EPROBE_DEFER)
>                         dev_err(&pdev->dev, "Failed to get clock.\n");
>                 goto err;
>         }
>

Yes, right, i will change it,
Thanks.

>>
>> -       usb11_phy = devm_phy_get(&pdev->dev, "usb-phy");
>> -       if (IS_ERR(usb11_phy)) {
>> -               if (PTR_ERR(usb11_phy) != -EPROBE_DEFER)
>> +       da8xx_ohci->usb11_phy = devm_phy_get(&pdev->dev, "usb-phy");
>> +       if (IS_ERR(da8xx_ohci->usb11_phy)) {
>> +               if (PTR_ERR(da8xx_ohci->usb11_phy) != -EPROBE_DEFER)
>>                         dev_err(&pdev->dev, "Failed to get phy.\n");
>> -               return PTR_ERR(usb11_phy);
>> +               error = PTR_ERR(da8xx_ohci->usb11_phy);
>> +               goto err;
>>         }
>
>
> same here
>
> ...
>
>
> Tested-by: David Lechner <david@lechnology.com>
>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v5 0/5] USB: ohci-da8xx: Add device tree support Axel Haslam <ahaslam@baylibre.com> - 2016-11-14 15:50 +0100
  [PATCH v5 2/5] USB: ohci: da8xx: Add wrappers for platform callbacks Axel Haslam <ahaslam@baylibre.com> - 2016-11-14 15:50 +0100
  [PATCH v5 1/5] USB: ohci: da8xx: use ohci priv data instead of globals Axel Haslam <ahaslam@baylibre.com> - 2016-11-14 15:50 +0100
    Re: [v5,1/5] USB: ohci: da8xx: use ohci priv data instead of globals David Lechner <david@lechnology.com> - 2016-11-20 04:00 +0100
      Re: [v5,1/5] USB: ohci: da8xx: use ohci priv data instead of globals Axel Haslam <ahaslam@baylibre.com> - 2016-11-21 10:10 +0100
  [PATCH v5 3/5] USB: ohci: da8xx: Allow a regulator to handle VBUS Axel Haslam <ahaslam@baylibre.com> - 2016-11-14 15:50 +0100
    Re: [v5,3/5] USB: ohci: da8xx: Allow a regulator to handle VBUS David Lechner <david@lechnology.com> - 2016-11-20 04:40 +0100
    Re: [v5,3/5] USB: ohci: da8xx: Allow a regulator to handle VBUS David Lechner <david@lechnology.com> - 2016-11-20 04:40 +0100
      Re: [v5,3/5] USB: ohci: da8xx: Allow a regulator to handle VBUS Axel Haslam <ahaslam@baylibre.com> - 2016-11-21 11:30 +0100
        Re: [v5,3/5] USB: ohci: da8xx: Allow a regulator to handle VBUS David Lechner <david@lechnology.com> - 2016-11-21 18:00 +0100
          Re: [v5,3/5] USB: ohci: da8xx: Allow a regulator to handle VBUS Axel Haslam <ahaslam@baylibre.com> - 2016-11-22 15:30 +0100

csiph-web