Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2539127rdb; Fri, 8 Dec 2023 10:59:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IFW5Xl3z+VyMGwnpCMuPtr5Y0EwC2oUhFphTmlis2qio2plSr1c+9AxICNsg9PCiJQYy6Ip X-Received: by 2002:a05:6358:249b:b0:170:17eb:3781 with SMTP id m27-20020a056358249b00b0017017eb3781mr367262rwc.41.1702061995082; Fri, 08 Dec 2023 10:59:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702061995; cv=pass; d=google.com; s=arc-20160816; b=uGuw5p4NK14mq9B15gUvVkEc/DVcMN8JK9J/7sf+r7r03w9WNw/DnpfW8Malvk7+BS /6tPviNa1c6+3VYYBKmIIR96LqxRck1hXyhtjEgAqRhfD9kaxO8lZgvvggO9wj+BcmAs 8EhYfEwAKgSOKZVyhpVcPHxP4xG4gop7XqnBm4qkHcIcGjQKkwauSBu+3qNbnOoZ06hO Cts4IWdbjxF3fAEVatZbMoFnhbS4IuH5lnihcfk9nxOHVf/YVMHgoVNmSDkO/6O/y1yx WWv6Worq5hCs+AIZ9OG8in0pmZExDBra5ebuGnps5FttiBrzFA90Q+3LEDoNliqqUzib o31Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:content-language:references:cc:to:subject :user-agent:date:message-id:dkim-signature; bh=NZ8jobPVJU6CaJcwzT3M1NPnIh0/Cahtdr1H3dOFEpM=; fh=QnJ8Q/8qAqkBJysEgQ1ALvz8UaZ+8saX7wEEuGbX/Fw=; b=ZCV9KOtnOWie4NSEYMgdRremTP1wJ5olEiyijTQRR6ulL9NDgEurgCauUvAVfBQbGz dgkpn6ysLAqvEGmigooDz7rH+mq7iIpr88rBYikDk7kyufDRnUaqd6ECJ4p8FvirdwMi HBaSiaUXhZwy76oe6d9ZC022k+4tI+3RzXWTY8SpxBfSL5Va9JWSQQ4V8vyF9XQR3bQa F+sCCP9eH2+Yj4541CYN+BvpzXHs+1qWoTiEE/yazZsy27CisbmP6FeJMKJgWIIdpTHd nGcGmq2UNAm/YsuSbIPPfT1cATqRz9/L5t/p26u/AxO/oYjb2XLx+rC+y+k2UaOH1p4n J0/Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=Jul6muvc; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id i34-20020a635422000000b005c661df2613si1878722pgb.292.2023.12.08.10.59.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 10:59:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=Jul6muvc; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 23A1B85A6CE1; Fri, 8 Dec 2023 10:59:52 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233860AbjLHS6y (ORCPT + 99 others); Fri, 8 Dec 2023 13:58:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229572AbjLHS6x (ORCPT ); Fri, 8 Dec 2023 13:58:53 -0500 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2074.outbound.protection.outlook.com [40.107.105.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C08F11F; Fri, 8 Dec 2023 10:58:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kUTHGyDWZAHBfigRi9Blv72unEypgJfsbIjFLGzwX5D9GY8P2oWI5m6L1HAyU05osvVhxQkoczXxvb2JGwo3SQsTDHambezRtPLhAjp4Tr8Y/9pU8sWLiS4dJAId5rpCT/iooq6Z0jsTAI3bkhd5H1ZcK0PXlV4ZCeNcl14tIf1MiPqITPB7TK28pW3uEQwz/f9lDP0uqIXI8aLHslml4aUFx31cx6PB+wbLFex1FmUmdm39Yv1K7fEnaD6bX6E2rswokMI9eCNcTJ6JfISGhqXuZfALUtiLP4j6haEHCJMIewA81sy03p0nbg6rUhxWW8SlMge2nsoi08sk2VmrPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NZ8jobPVJU6CaJcwzT3M1NPnIh0/Cahtdr1H3dOFEpM=; b=D6xB+v0pt/mLoKpp336tSBx6aKbHcpQnqgONYQuVNSSx21JjatsVENJd1iB5wBXyEUgOlVzpWbYSmn2H8VBQgDQmcj9dD8u4ZVvkr7lFIecb/U3QTaqMCsnOnVAr/+yugzph7CKdbfrHeNYZa8WeDZTBLzfYs8zmDiBCnNFhu1ZeeymXNLXpoH4A8UPJFTih9T6CV1SwrLCSAuME5v7wdZLI/8/K/8ITsIzfvnJiSxLj4+GY2nE1InthSWKo7GXym2hEhOERUgVGP5TFPDRQ7RC0kGZVYWStCPuFOgXUBUDHXDkkpcGSUXqU9u4zhPf7PW7dqtycAi3SxgR3JrfJRg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wolfvision.net; dmarc=pass action=none header.from=wolfvision.net; dkim=pass header.d=wolfvision.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NZ8jobPVJU6CaJcwzT3M1NPnIh0/Cahtdr1H3dOFEpM=; b=Jul6muvcO6pPKwHHohBk5J1nIvOZS9E+HRHdxqdN6rAc3HYTVG2PVsWUivXZ0ZD8B2+1vopaHU4+nrLc3LX6xYtOPceem9PSinhPCkDCEP/HrHTM+FbepO8nFjgVOnK0dLD2YjDfkrxT/HpafTO+Z0v/5x3siN5UtC06l8VJSNM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wolfvision.net; Received: from VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) by PA4PR08MB6160.eurprd08.prod.outlook.com (2603:10a6:102:e5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.27; Fri, 8 Dec 2023 18:58:56 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::6b40:1e6f:7c94:71dc]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::6b40:1e6f:7c94:71dc%4]) with mapi id 15.20.7068.029; Fri, 8 Dec 2023 18:58:55 +0000 Message-ID: <196acb44-fb0d-45b6-a9c3-b5a289a41917@wolfvision.net> Date: Fri, 8 Dec 2023 19:58:52 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/4] usb: typec: tipd: add function to request firmware To: Heikki Krogerus Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org References: <20231207-tps6598x_update-v1-0-dc21b5301d91@wolfvision.net> <20231207-tps6598x_update-v1-2-dc21b5301d91@wolfvision.net> Content-Language: en-US From: Javier Carrasco In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: FR3P281CA0140.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:95::12) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|PA4PR08MB6160:EE_ X-MS-Office365-Filtering-Correlation-Id: 37c833b9-6182-4699-727c-08dbf81fb9b5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gKOQMYzKPrgWJZBNYkBy6CJZdF2A7X4iE8stw/LddQZGxzjiEReu4n9M0UA74cNN1gR+2za450jUpJMOJHzSm4/2UveUowAom14HUtkQksyrkqcMjNcRUPpNDByFBcUs1eVrMwGrXMaEtk9mTqlsvo8sPJL6bw0VICBEs8uXv7EgXjKJMA16YrPtAjNvwPE1XYg7rJB1+eWEyXDz9PyV/jIB8w0XV2OQ4fmyvxySt7UT1aY6OeQrm40Zu8V6IIB3JEI7dKZKyLAq1GX1omR9S+O55GIlMh4SFaO3OYMjF8xC5XmxMZ90Q01oTNorcanY7KIECjFq+ZHkjxf5tIhBrG6jyS9FAIdPcFUGjQGG/xtYOzjxVhp4nTHrE+a9JlWml7BuDZ5UQ8RkKLiemkVc67Nu4U1OlPpyiUo0NH31G4ilcdriiBvV6CKqYLLGUuLCi680USf1DoSqHuO9fZ3i3OLO+aI87kv9Aj0T+/0cJgTZyPTAvosA5NYFdHO8AVyV9E6j8j4wVZcYZSZSmVv/QBWP1ImdUZYUOHRFIjwGE/fKTby5H4KXKKSLC+djqw6AqCfq/C6ijmvoq4a0zRF79GbGT306TfkojW4UzI+2rtX8ydSnel+B6kVuyvj9YdeD6dSl56TNjaE0BxAnxVMCSA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR08MB4974.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(396003)(39850400004)(346002)(366004)(376002)(230922051799003)(186009)(64100799003)(451199024)(1800799012)(5660300002)(41300700001)(2906002)(38100700002)(86362001)(66946007)(6666004)(6512007)(478600001)(2616005)(66476007)(31696002)(8936002)(6506007)(53546011)(83380400001)(6486002)(44832011)(66556008)(8676002)(316002)(4326008)(36756003)(6916009)(66899024)(31686004)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Skg0dlNvV3Z0bXVuWmNnbUQ1ZXBER0RBK3BWQkNFVmdWSk9adEJ5UTB6MjlB?= =?utf-8?B?WTFlQkMrb0VWbnVqRFVHS3BBTVhUbG9Tc3F2TEFscnJ1ZHlCUWZQL0R4cUMr?= =?utf-8?B?MmtEMDBUY2NVeW1PdFluWEFjUnorU2pudzBURzk0YUxjWUxKQS9mRWg4STZN?= =?utf-8?B?U01jL253VHFJMEJ4OFd3eWtRby8xYUNVNHd1dkRtdzNWYy9XT3V6NDFubXJm?= =?utf-8?B?eEFGSmJwWlZFSlJMSVYwK1pqNXdKYzZKcS9jOWMyOERWR2wrdm8vRXN0UDNK?= =?utf-8?B?YW1zU3RNZ1ZOZHhjZmxwWkxOOUE3VWs5U3NVKzgzM2JsN0pzTzduQTBtZUNY?= =?utf-8?B?Zkg1c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ERnRm9ldDM2ZC9CdFVSY1dEYVU4MUZLNHUrSXhJOTRX?= =?utf-8?B?aTBDQ1JBL2NiMmsxMEtEQ29nMzAreitENGVEQnJEZ1lSNGtWRzE1VWM4YTNY?= =?utf-8?Q?q1wEtOVBAeDMaQp0MiDfDA6r/mCNRvX6n+JeDY41rc=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: 37c833b9-6182-4699-727c-08dbf81fb9b5 X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2023 18:58:55.2523 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e94ec9da-9183-471e-83b3-51baa8eb804f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: m4XtbKa0c6iVI2vlDbU0yKA4W6DHrbxG7fcnX2AKlfx5DzUEPeydh3yiSqAmS6KuxwTavNEwV7JrW3dIvRWlrKGk5vXk0XPxq2pFuZbP2p4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6160 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 howler.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 (howler.vger.email [0.0.0.0]); Fri, 08 Dec 2023 10:59:52 -0800 (PST) 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. Note that we are only triggering the update if the device is in patch mode, so a firmware will be expected for the device to run and reach the app mode. In that case deferring the probe and keeping on trying to make the update makes sense because otherwise the device will not be able to offer its functionality. If the device is not in patch mode, no update will be triggered and the firmware will not be requested, so there will not be any unnecessary probe deferring. I see that the driver you mentioned checks if the system_state is still not SYSTEM_RUNNING to defer the probe. I have not tested if something like that would be possible in this case, but giving up on the first attempt if the firmware is not found makes the assumption that the filesystem where the fw resides will always be ready when the probe function is called, which in my particular case is a wrong assumption. If the firmware was updated at any point during normal operation, the assumption would be definitely right, but maybe not while booting. Thank you and best regards, Javier Carrasco