Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5384179rdb; Wed, 13 Dec 2023 07:16:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IE+si44uMEkAuS/Z+kBJK8Pmwjs0QLMI18kfv5tqvRjsTXpU7QMwTTlafi30TOIyQ+0EG5X X-Received: by 2002:a17:902:8301:b0:1d0:bcb2:4b8a with SMTP id bd1-20020a170902830100b001d0bcb24b8amr3858301plb.131.1702480570653; Wed, 13 Dec 2023 07:16:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702480570; cv=none; d=google.com; s=arc-20160816; b=dceJLRoGnk6rOTBpHahTgOzwZxliyISjVSQ456ukMEqWC6fNFbHuOswSZj07+eUHZb +SldWr9KHUMCeMwvFhPtak/dl5sRV9NCqsnTgJ9E80p8ZQKHAv6EyYtERBCBwndXnu54 YA0kdKwOWCfZ2eswMNIQafQCs57R4r1gj1N622CtSbcsjiS82a7zgGgcDSb38973pmIi sOiWkf0ewJLeH4fmIlUt+ImqtXjGTaa6CVnPkUhLs59ObNknAHDMy10z5xvGVmETNJRI sbwawatqWecuSx9eLwATJ4pfJvspU2tL0GFcMK1YPOvZX0VrJ5uDd97WkzKn4EdYVcZD RohA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=kQAbCEW9uNUsVrBsvHa7WpetWQSRAdk9bBP4dZZwVGA=; fh=W2pHPIJPqCP8HsXFXoA7ZzEbMb5czJzPDgB2sMvpzSo=; b=ba9eWN/objHXVLCEa0gsCfReFcv7PbgZbXaHo2tZoMPSy0IrRHMAk7c0VuO5D3+H4g jWP3nFJ8yLg639sZCE/dk+dVHPddnwtTVOKpos51pOIdr7B0iYA2Zx6Q6GehoJmH+Xjq 3SSMx5i2K/dQOCMNP4SbmbLUDem3+tXLLV/BwmjARXQEjOX51jLFJgdsyiTBruIANSIt 5cvA9+N7EKQTMqlmEhMj31klJXf28aQvjtphk2px3BvLe5OBR7z5rpckOP4K9VoJF6op PCfzpuu+8jpN8KFb70NkX83lZktW2IkcwC8O6u0zQwrOCyeLnomRkjb4rnVrElzDsDTh gMWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=WuyxeKSD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id z10-20020a65610a000000b005c6bd30ed48si9545418pgu.20.2023.12.13.07.16.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 07:16:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=WuyxeKSD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 988408217A64; Wed, 13 Dec 2023 07:16:07 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442261AbjLMPPx (ORCPT + 99 others); Wed, 13 Dec 2023 10:15:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442172AbjLMPPw (ORCPT ); Wed, 13 Dec 2023 10:15:52 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85661F7; Wed, 13 Dec 2023 07:15:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702480558; x=1734016558; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=Ga/06Gm65DZz6cxBTRPoAOr5ox5/yudCTiMMj5NoYNM=; b=WuyxeKSDenD+U7sk1EJ3VZZUldlxwQTI0rb0ZQaNOF49XfJZ1XGZW2Zu jHwCFeW5xL1Is1IBcZ+awz/WctrYr6RjOmDQDegOlKvKVnqymhIKlJxxW 2foi+Szr8Ju2g7ZWiNWkeSQ4QYR3HMfoZ3hdxUZOqbqW7gkZYWSgX3Rzv OTnn2Si7eBQp5Cj77JofMPs8ywAHgVKEu1n4CUUmm6DUrawjKEXASea0G WdyDhuBIvbqsCnxLAT0+fzm6sXU8gmaZZXJxllAFXrsedxsO29BJoEBFA 2qk8j7LCuaLiBUECmPn8pVvo0joBVbwMyUl4tvhnf/NliP/UhCS3wxTbk w==; X-IronPort-AV: E=McAfee;i="6600,9927,10923"; a="398820987" X-IronPort-AV: E=Sophos;i="6.04,273,1695711600"; d="scan'208";a="398820987" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Dec 2023 07:15:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10923"; a="750150031" X-IronPort-AV: E=Sophos;i="6.04,273,1695711600"; d="scan'208";a="750150031" Received: from kuha.fi.intel.com ([10.237.72.185]) by orsmga006.jf.intel.com with SMTP; 13 Dec 2023 07:15:55 -0800 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Wed, 13 Dec 2023 17:15:54 +0200 Date: Wed, 13 Dec 2023 17:15:54 +0200 From: Heikki Krogerus To: Javier Carrasco Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/4] usb: typec: tipd: add function to request firmware Message-ID: References: <20231207-tps6598x_update-v1-0-dc21b5301d91@wolfvision.net> <20231207-tps6598x_update-v1-2-dc21b5301d91@wolfvision.net> <196acb44-fb0d-45b6-a9c3-b5a289a41917@wolfvision.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 13 Dec 2023 07:16:07 -0800 (PST) On Tue, Dec 12, 2023 at 03:41:35PM +0100, Javier Carrasco wrote: > > > On 12.12.23 15:15, Heikki Krogerus wrote: > > Hi, > > > > On Fri, Dec 08, 2023 at 07:58:52PM +0100, Javier Carrasco wrote: > >> Hi Heikki, > >> > >> On 08.12.23 15:55, Heikki Krogerus wrote: > >> > >>>> + ret = request_firmware(fw, firmware_name, tps->dev); > >>>> + if (ret) { > >>>> + dev_err(tps->dev, "failed to retrieve \"%s\"\n", firmware_name); > >>>> + /* probe deferring in case the file system is not ready */ > >>>> + return (ret == -ENOENT) ? -EPROBE_DEFER : ret; > >>> > >>> It's more likely that the firmware really isn't available, and it will > >>> never be available in this case. I think there is only one place in > >>> kernel where failing request_firmware() can lead to deferred probe > >>> (drivers/tee/optee/smc_abi.c) and there the code can actually see the > >>> system state - that's actually the condition. > >>> > >>> So just return dev_err_probe() here: > >>> > >>> ret = request_firmware(fw, firmware_name, tps->dev); > >>> if (ret) > >>> return dev_err_probe(tps->dev, ret, "failed to retrieve \"%s\"", firmware_name); > >>> > >> Thank you for your feedback. > >> > >> This solution arose from a real use case: in the system I am using to > >> test the tps65987d, the filesystem is not ready when the probe function > >> is called. If I just return on -ENOENT, the device will never get the > >> update. > > > > Just like all the other devices that require firmware. This driver is > > no different from the others, and it is also not the only one that > > needs the firmware only in special cases. Just make the firmware part > > of your ramdisk, or build the driver as a module. > > I wonder why then there is no general solution that does not force the > driver to be built as a module. Why would you need anything like that? Are you saying that even if you put the firmware into your ramdisk, the driver still fails to find the firmware if it's statically build? If so, then there is something else wrong. > If there is none, the documentation > should mention that somehow (sorry if it does, I missed it). Actually a > solution like the one implemented in the driver you mentioned could be > used by any driver that can wait to be updated when the system is > running. > > > Are these firmwares available linux-firmware (or are the going to be)? > > https://git.kernel.org/?p=linux/kernel/git/firmware/linux-firmware.git > > > > thanks, > > > The firmware (at least for the tps6598x) can be tailored with a TI > specific tool and it depends on the use case, so I suppose making it > public does not make much sense. Okay. thanks, -- heikki