Re: [PATCHv2 net-next] net: modernize ioremap in probe

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

 



On Thu, Nov 14, 2024 at 3:10 AM Horatiu Vultur
<horatiu.vultur@xxxxxxxxxxxxx> wrote:
>
> The 11/11/2024 12:02, Rosen Penev wrote:
>
> Hi Rosen,
>
> > diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
> > index 3234a960fcc3..375e9a68b9a9 100644
> > --- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
> > +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
> > @@ -77,20 +77,12 @@ static int lan966x_create_targets(struct platform_device *pdev,
> >          * this.
> >          */
> >         for (idx = 0; idx < IO_RANGES; idx++) {
> > -               iores[idx] = platform_get_resource(pdev, IORESOURCE_MEM,
> > -                                                  idx);
> > -               if (!iores[idx]) {
> > -                       dev_err(&pdev->dev, "Invalid resource\n");
> > -                       return -EINVAL;
> > -               }
> > -
> > -               begin[idx] = devm_ioremap(&pdev->dev,
> > -                                         iores[idx]->start,
> > -                                         resource_size(iores[idx]));
> > -               if (!begin[idx]) {
> > +               begin[idx] = devm_platform_get_and_ioremap_resource(
> > +                       pdev, idx, &iores[idx]);
> > +               if (IS_ERR(begin[idx])) {
> >                         dev_err(&pdev->dev, "Unable to get registers: %s\n",
> >                                 iores[idx]->name);
> > -                       return -ENOMEM;
> > +                       return PTR_ERR(begin[idx]);
> >                 }
> >         }
> >
>
> Unfortunately, this breaks the lan966x probe. With this change I get the
> following errors:
> [    1.705315] lan966x-switch e0000000.switch: can't request region for resource [mem 0xe0000000-0xe00fffff]
> [    1.714911] lan966x-switch e0000000.switch: Unable to get registers: cpu
> [    1.721607] lan966x-switch e0000000.switch: error -EBUSY: Failed to create targets
> [    1.729173] lan966x-switch: probe of e0000000.switch failed with error -16
>
Yes, also causes problems with another platform.

This commit should be abandoned.
> --
> /Horatiu





[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux