[PATCH v2] firmware: arm_scmi: Delete the meaningless scmi_bus_id.
Dan Carpenter
dan.carpenter at linaro.org
Mon Dec 16 07:03:36 PST 2024
On Mon, Dec 16, 2024 at 06:37:01PM +0800, gchen chen wrote:
> > > > diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
> > > > index 1b5fb2c4ce86..bbf1f05f2be3 100644
> > > > --- a/drivers/firmware/arm_scmi/driver.c
> > > > +++ b/drivers/firmware/arm_scmi/driver.c
> > > > @@ -2641,8 +2641,8 @@ static int scmi_chan_setup(struct scmi_info *info, struct device_node *of_node,
> > > > cinfo->max_msg_size = info->desc->max_msg_size;
> > > >
> > > > /* Create a unique name for this transport device */
> > > > - snprintf(name, 32, "__scmi_transport_device_%s_%02X",
> > > > - idx ? "rx" : "tx", prot_id);
> > > > + snprintf(name, 32, "__scmi_transport_device_%s",
> > > > + idx ? "rx" : "tx");
> >
> > I agree on what Dan said AND also this results in having the same name for different
> > devices across 2 instances if you have a per-protocol channel because you havent anymore
> > the protocol_id bit.
> hi Cristian,and dan
> Because I used a 3-tuple [parent name, name, protocol] when
> creating the SCMI device name, I removed the prot_id from the
> parameter ‘name’ when creating transport devices. This way, it avoids
> the repetition of protocol ID in the SCMI device name.
>
I haven't actually tested this code, I'm just going by reviewing.
scmi_channels_setup() calls scmi_txrx_setup() in a loop with a different
port_id each time. The info->dev is the same on each iteration. Since
the name is the same except for the rx/tx then __scmi_device_create() will
find the existing device on the first line and return success instead of
allocating a new device:
scmi_dev = scmi_child_dev_find(parent, protocol, name);
if (scmi_dev)
return scmi_dev;
regards,
dan carpenter
More information about the linux-arm-kernel
mailing list