[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAE-0n50jvejyc1HO62mDBCCoV8eT3uL9sgu2B=ZeSHKxv=w+SA@mail.gmail.com>
Date: Mon, 16 Dec 2024 14:49:37 -0500
From: Stephen Boyd <swboyd@...omium.org>
To: Abhishek Pandit-Subedi <abhishekpandit@...omium.org>
Cc: chrome-platform@...ts.linux.dev, heikki.krogerus@...ux.intel.com,
linux-usb@...r.kernel.org, tzungbi@...nel.org, akuchynski@...gle.com,
pmalani@...omium.org, jthies@...gle.com, dmitry.baryshkov@...aro.org,
badhri@...gle.com, rdbabiera@...gle.com, Benson Leung <bleung@...omium.org>,
Guenter Roeck <groeck@...omium.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 5/7] platform/chrome: cros_ec_typec: Displayport support
Quoting Abhishek Pandit-Subedi (2024-12-13 10:33:19)
> On Wed, Dec 11, 2024 at 1:58 PM Stephen Boyd <sboyd@...nel.org> wrote:
> >
> > Quoting Abhishek Pandit-Subedi (2024-12-06 15:38:16)
> > > diff --git a/drivers/platform/chrome/cros_typec_altmode.c b/drivers/platform/chrome/cros_typec_altmode.c
> > > new file mode 100644
> > > index 000000000000..bb7c7ad2ff6e
> > > --- /dev/null
> > > +++ b/drivers/platform/chrome/cros_typec_altmode.c
> > > @@ -0,0 +1,281 @@
[...]
> > > +struct typec_altmode *
> > > +cros_typec_register_displayport(struct cros_typec_port *port,
> > > + struct typec_altmode_desc *desc,
> > > + bool ap_mode_entry)
> > > +{
> > > + struct typec_altmode *alt;
> > > + struct cros_typec_altmode_data *data;
> > > +
> > > + alt = typec_port_register_altmode(port->port, desc);
> > > + if (IS_ERR(alt))
> > > + return alt;
> > > +
> > > + data = devm_kzalloc(&alt->dev, sizeof(*data), GFP_KERNEL);
> > > + if (!data) {
> > > + typec_unregister_altmode(alt);
> > > + return ERR_PTR(-ENOMEM);
> > > + }
> > > +
> > > + INIT_WORK(&data->work, cros_typec_altmode_work);
> > > + mutex_init(&data->lock);
> > > + data->alt = alt;
> > > + data->port = port;
> > > + data->ap_mode_entry = ap_mode_entry;
> > > + data->sid = desc->svid;
> > > + data->mode = desc->mode;
> > > +
> > > + typec_altmode_set_ops(alt, &cros_typec_altmode_ops);
> > > + typec_altmode_set_drvdata(alt, data);
> >
> > 'data' is of type struct cros_typec_altmode_data here
> This should have been allocated as cros_typec_dp_data. Missed during a
> previous refactor that changed the type from a union to this format.
It would be good to have the cros_typec_altmode_data member be somewhere
besides the first member of cros_typec_dp_data so that this fails faster
when stashing the pointer into the drvdata and treating it as the wrong
type on the other side.
Powered by blists - more mailing lists