From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH] leds:lp55xx: Correct Kconfig dependency for f/w user helper Date: Tue, 08 Sep 2015 11:03:52 +0200 Message-ID: References: <1441628701-3022-1-git-send-email-tiwai@suse.de> <55ED9CE1.1080002@samsung.com> <55EE2C0F.5040101@ti.com> <55EE9B7B.7020503@ti.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: Received: from mx2.suse.de ([195.135.220.15]:44436 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752866AbbIHJDz (ORCPT ); Tue, 8 Sep 2015 05:03:55 -0400 In-Reply-To: <55EE9B7B.7020503@ti.com> Sender: linux-leds-owner@vger.kernel.org List-Id: linux-leds@vger.kernel.org To: "Kim, Milo" Cc: Jacek Anaszewski , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, Richard Purdie , Bryan Wu On Tue, 08 Sep 2015 10:25:31 +0200, Kim, Milo wrote: > > > The fallback to user helper mode is bad for the recent udev, since > > udev already dropped the f/w support code completely. Thus every > > non-existing f/w load will result in 60 seconds stall. > > However, timeout is changed to MAX_JIFFY_OFFSET when FW_OPT_UEVENT flag > is not set. > > static int _request_firmware_load(struct firmware_priv *fw_priv, > unsigned int opt_flags, long timeout) > { > (snip) > > if (opt_flags & FW_OPT_UEVENT) { > buf->need_uevent = true; > dev_set_uevent_suppress(f_dev, false); > dev_dbg(f_dev, "firmware: requesting %s\n", buf->fw_id); > kobject_uevent(&fw_priv->dev.kobj, KOBJ_ADD); > } else { > timeout = MAX_JIFFY_OFFSET; > } > > retval = wait_for_completion_interruptible_timeout(&buf->completion, > timeout); > } > > It will take too long to get the result. Why it takes too long? It's the timeout, so it happens only when the input isn't completed. > I don't know the reason why > timeout was modified in the commit [68ff2a00dbf5: firmware_loader: > handle timeout via wait_for_completion_interruptible_timeout()]. My guess about the rationale behind the change is that, if it's no udev event, the (more-or-less) manual interaction is expected. If it's done by human, we can't expect that it's typed always so quickly in time. > Moreover, this time value is not identical to the result of > timeout_show(). That's bad, indeed. > Is it OK to remove the line as follows? > > diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c > index 171841a..8187404 100644 > --- a/drivers/base/firmware_class.c > +++ b/drivers/base/firmware_class.c > @@ -909,8 +909,6 @@ static int _request_firmware_load(struct > firmware_priv *fw_priv, > dev_set_uevent_suppress(f_dev, false); > dev_dbg(f_dev, "firmware: requesting %s\n", buf->fw_id); > kobject_uevent(&fw_priv->dev.kobj, KOBJ_ADD); > - } else { > - timeout = MAX_JIFFY_OFFSET; > } > > retval = wait_for_completion_interruptible_timeout(&buf->completion, > > If the driver requires longer loading time, then it can be done by > updating '/sys/class/firmware/timeout'. I guess this would be harmless for most cases. But it's better to have a clarification why the shorter timeout is mandatory... thanks, Takashi