Re: [PATCH v13 10/10] drm/bridge: it6505: Register Type C mode switches

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

 



Hi Andy,

Thanks for the review.

On Mon, Mar 6, 2023 at 8:03 PM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> On Fri, Mar 03, 2023 at 10:33:50PM +0800, Pin-yen Lin wrote:
> > Register USB Type-C mode switches when the "mode-switch" property and
> > relevant port are available in Device Tree. Configure the "lane_swap"
> > state based on the entered alternate mode for a specific Type-C
> > connector, which ends up updating the lane swap registers of the it6505
> > chip.
>
> ...
>
> > +     it6505->port_data = devm_kcalloc(dev, switch_desc->num_typec_switches,
> > +                                      sizeof(struct it6505_typec_port_data),
> > +                                      GFP_KERNEL);
>
> > +
>
> Same, no need for a blank line here.
>
I'll fix this in the next version.
> > +     if (!it6505->port_data) {
> > +             ret = -ENOMEM;
> > +             goto unregister_mux;
> > +     }
>
> ...
>
> > +             it6505->port_data[i].lane_swap = (dp_lanes[0] / 2 == 1);
>
> ' % 2 == 0' ?
>
Per another patch, I'll update this into `< 2`
> ...
>
> Wouldn't be better to have
>
>         ret = PTR_ERR_OR_ZERO(extcon);
>
> here and amend the following accordingly?
>
> >       if (PTR_ERR(extcon) == -EPROBE_DEFER)
> >               return -EPROBE_DEFER;
> >       if (IS_ERR(extcon)) {
> > -             dev_err(dev, "can not get extcon device!");
> > -             return PTR_ERR(extcon);
> > +             if (PTR_ERR(extcon) != -ENODEV)
> > +                     dev_warn(dev, "Cannot get extcon device: %ld\n",
> > +                              PTR_ERR(extcon));
> > +             it6505->extcon = NULL;
> > +     } else {
> > +             it6505->extcon = extcon;
> >       }
> >
> > -     it6505->extcon = extcon;
> > +     init_completion(&it6505->mux_register);
> > +     ret = it6505_register_typec_switches(dev, it6505);
> > +     if (ret) {
> > +             if (ret != -ENODEV)
> > +                     dev_warn(dev, "Didn't register Type-C switches, err: %d\n",
> > +                              ret);
> > +             if (!it6505->extcon) {
> > +                     dev_err(dev, "Both extcon and typec-switch are not registered.\n");
> > +                     return -EINVAL;
> > +             }
> > +     }
>
>
> Perhaps
>
>         if (ret != -ENODEV)
>                 dev_warn(dev, "Didn't register Type-C switches, err: %d\n", ret);
>
>         if (ret && !it6505->extcon) {
>                 dev_err(dev, "Both extcon and typec-switch are not registered.\n");
>                 return ret;
>         }
>
> ?


Thanks for the suggestion! I'll update this in v14.
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
Best regards,
Pin-yen




[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux