From patchwork Tue Nov 19 22:33:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Felsch X-Patchwork-Id: 13880605 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B2F61C2DA2 for ; Tue, 19 Nov 2024 22:34:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732055662; cv=none; b=q4461l3F8FkGc02xie1dp4AXmgEoQG33rk6+IbtnwvGkYOXLzgS3VDYzLCK+1B63J+1OEKfCoBDap8kw7GNTs0dL3xd4+rh2mWiEvmmuBW613bYQPQ9qtGYW0xshZ/Dlzeio/KXQTN2FHUUF2aVtY9LYGTXSYM1sJBe892sJvzc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732055662; c=relaxed/simple; bh=XsoLkw4+T7bCU2TKCMU1O3jt/Rbh8nGvFJ2vrAS9LBM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OS/ARwk4UhEqMyS8GJGIIvDPQNMga6rKKRIRQD3l10OisalLhdipoZPqY6qtVjNJ+MPFQ3RgWQFBM9BZ1MQt60M6SWADWkZ06ovDGwO7Tw/4y7kDAoFlcZQ4babeDhIpYQgDOh5WWJClbMRX3VpPEMHzCZXjEojWwC10vvE1mTc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from dude02.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::28]) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1tDWnF-0002gF-4s; Tue, 19 Nov 2024 23:33:57 +0100 From: Marco Felsch Date: Tue, 19 Nov 2024 23:33:50 +0100 Subject: [PATCH 1/5] firmware_loader: expand firmware error codes with skip error Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241119-v6-10-topic-touchscreen-axiom-v1-1-6124925b9718@pengutronix.de> References: <20241119-v6-10-topic-touchscreen-axiom-v1-0-6124925b9718@pengutronix.de> In-Reply-To: <20241119-v6-10-topic-touchscreen-axiom-v1-0-6124925b9718@pengutronix.de> To: Luis Chamberlain , Russ Weight , Greg Kroah-Hartman , "Rafael J. Wysocki" , Andrew Morton , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Dmitry Torokhov , Kamel Bouhara , Marco Felsch , Henrik Rydberg , Danilo Krummrich Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-input@vger.kernel.org, kernel@pengutronix.de, Marco Felsch X-Mailer: b4 0.14.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:1101:1d::28 X-SA-Exim-Mail-From: m.felsch@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Add FW_UPLOAD_ERR_SKIP to allow drivers to inform the firmware_loader framework that the update is not required. This can be the case if the user provided firmware matches the current running firmware. Sync lib/test_firmware.c file accordingly. Signed-off-by: Marco Felsch --- drivers/base/firmware_loader/sysfs_upload.c | 1 + include/linux/firmware.h | 2 ++ lib/test_firmware.c | 1 + 3 files changed, 4 insertions(+) diff --git a/drivers/base/firmware_loader/sysfs_upload.c b/drivers/base/firmware_loader/sysfs_upload.c index 829270067d16..b3cbe5b156e3 100644 --- a/drivers/base/firmware_loader/sysfs_upload.c +++ b/drivers/base/firmware_loader/sysfs_upload.c @@ -28,6 +28,7 @@ static const char * const fw_upload_err_str[] = { [FW_UPLOAD_ERR_RW_ERROR] = "read-write-error", [FW_UPLOAD_ERR_WEAROUT] = "flash-wearout", [FW_UPLOAD_ERR_FW_INVALID] = "firmware-invalid", + [FW_UPLOAD_ERR_SKIP] = "skip", }; static const char *fw_upload_progress(struct device *dev, diff --git a/include/linux/firmware.h b/include/linux/firmware.h index aae1b85ffc10..46d2192b733a 100644 --- a/include/linux/firmware.h +++ b/include/linux/firmware.h @@ -29,6 +29,7 @@ struct firmware { * @FW_UPLOAD_ERR_RW_ERROR: read or write to HW failed, see kernel log * @FW_UPLOAD_ERR_WEAROUT: FLASH device is approaching wear-out, wait & retry * @FW_UPLOAD_ERR_FW_INVALID: invalid firmware file + * @FW_UPLOAD_ERR_SKIP: firmware is already up to date, skip update * @FW_UPLOAD_ERR_MAX: Maximum error code marker */ enum fw_upload_err { @@ -41,6 +42,7 @@ enum fw_upload_err { FW_UPLOAD_ERR_RW_ERROR, FW_UPLOAD_ERR_WEAROUT, FW_UPLOAD_ERR_FW_INVALID, + FW_UPLOAD_ERR_SKIP, FW_UPLOAD_ERR_MAX }; diff --git a/lib/test_firmware.c b/lib/test_firmware.c index bcb32cbff188..6715eac10c6b 100644 --- a/lib/test_firmware.c +++ b/lib/test_firmware.c @@ -1133,6 +1133,7 @@ static const char * const fw_upload_err_str[] = { [FW_UPLOAD_ERR_RW_ERROR] = "read-write-error", [FW_UPLOAD_ERR_WEAROUT] = "flash-wearout", [FW_UPLOAD_ERR_FW_INVALID] = "firmware-invalid", + [FW_UPLOAD_ERR_SKIP] = "skip", }; static void upload_err_inject_error(struct test_firmware_upload *tst,