Re: [PATCH v3] usb/hcd: Send a uevent signaling that the host controller had died

From: Alan Stern
Date: Wed Apr 17 2019 - 16:39:26 EST


On Wed, 17 Apr 2019, Raul Rangel wrote:

> On Wed, Apr 17, 2019 at 03:14:14PM -0400, Alan Stern wrote:
> > On Wed, 17 Apr 2019, Raul E Rangel wrote:
> >
> > > +/* Workqueue routine for when the root-hub has died. */
> > > +static void hcd_died_work(struct work_struct *work)
> > > +{
> > > + struct usb_hcd *hcd = container_of(work, struct usb_hcd, died_work);
> > > + char *env[] = {
> > > + "ERROR=DEAD",
> > > + NULL
> > > + };
> >
> > This can now be
> >
> > static const char *env[] = ...
> >
> > right? There's no need for the array to be reinitialized every time
> > the routine runs.
> I originally tried to make it const, but kobject_uevent_env doesn't
> declare the parameter as const, so the compiler yelled at me. I could
> make it static, but a static without a const makes me wary. I can add it
> if you think it's fine.

This sounds like a golden opportunity! Submit a separate patch making
the parameter to kobject_uevent_env be const (actually const char *
const []), then submit this patch on top of that one.

Alan Stern