Re: [PATCH] platform/chrome: Add ChromeOS EC USB driver
From: Tzung-Bi Shih
Date: Tue Jul 01 2025 - 04:56:40 EST
On Mon, Jun 30, 2025 at 01:59:39PM +0200, Dawid Niedźwiecki wrote:
> On Fri, Jun 27, 2025 at 9:53 AM Tzung-Bi Shih <tzungbi@xxxxxxxxxx> wrote:
> > On Tue, Jun 24, 2025 at 11:00:28AM +0000, Dawid Niedzwiecki wrote:
> > > + /*
> > > + * Do not register the same EC device twice. The probing is performed every
> > > + * reboot, sysjump, crash etc. Recreating the /dev/cros_X file every time
> > > + * would force all application to reopen the file, which is not a case for
> > > + * other cros_ec_x divers. Instead, keep the cros_ec_device and cros_ec_usb
> > > + * structures constant and replace USB related structures for the same EC
> > > + * that is reprobed.
> > > + *
> > > + * The driver doesn't support handling two devices with the same idProduct,
> > > + * but it will never be a real usecase.
> > > + */
> >
> > I don't quite understand why does it need to memorize the registered ECs.
> > Supposedly, the probe function is only called few times during booting, and
> > gets success once. Hot-plugs?
> >
>
> The probe is called every time the EC device boots from the beginning
> - sysjumps, crashes, reboots etc. It succeeds the first time.
> Once the /dev/cros_X file is created, we need the possibility to
> access the same EC device, with the same, previously created file.
> The only way to do that is to reused the already created
> cros_ec_device structure.
What are the shortcomings if it re-creates /dev/cros_X everytime? Isn't it
also a way for userland programs to be aware of the EC device crashes?
Why other cros_ec_X drivers doesn't need the mechanism?