[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2023081913-trifocals-flagpole-cdf7@gregkh>
Date: Sat, 19 Aug 2023 11:56:33 +0200
From: "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>
To: Rodríguez Barbarin, José Javier
<JoseJavier.Rodriguez@...gon.com>
Cc: "jirislaby@...nel.org" <jirislaby@...nel.org>,
"morbidrsa@...il.com" <morbidrsa@...il.com>,
"linux-serial@...r.kernel.org" <linux-serial@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"jth@...nel.org" <jth@...nel.org>,
Sanjuán García, Jorge
<Jorge.SanjuanGarcia@...gon.com>
Subject: Re: [PATCH v2 1/1] mcb: create dedicated bus_type for mcb_bus and
mcb_device
On Fri, Aug 18, 2023 at 11:03:03AM +0000, Rodríguez Barbarin, José Javier wrote:
> When allocating a new mcb_bus the bus_type is added to the mcb_bus
> itself, causing an issue when calling mcb_bus_add_devices().
> This function is not only called for each mcb_device under the
> mcb_bus but for the bus itself.
>
> This causes a crash when freeing the ida resources as the bus numbering
> gets corrupted due to a wrong cast of structs mcb_bus and mcb_device.
Why not just fix this up and determine the "type" of the device before
you cast anything?
> Make the release of the mcb devices and their mcb bus explicit.
That's good, but now you have a new bus type which is a bit odd just for
the bus controller. It's not necessarily bad, but not generally what
other busses do. As an example, USB controllers are not their own bus
type, but rather, a different type of device on the same bus. Same goes
for greybus devices/controllers.
So perhaps try doing that instead of creating a whole new bus here?
thanks,
greg k-h
Powered by blists - more mailing lists