From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 10571C433EF for ; Wed, 2 Mar 2022 14:02:52 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4E0AA83C98; Wed, 2 Mar 2022 15:02:39 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=siemens.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=siemens.com header.i=@siemens.com header.b="efQzDufk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4BC6983C9B; Wed, 2 Mar 2022 15:02:37 +0100 (CET) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on20629.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1b::629]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 75B0F837E2 for ; Wed, 2 Mar 2022 15:02:29 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=siemens.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jan.kiszka@siemens.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PY+FNRvsgGZfz9DHod+jhnrh+2sdYOdW4rZtmX3x5gBd+uligtmxd/ey1PxawsfyhLy1JHu0bcQ5yOBwPqBQN0HuD4po0M3xQjol3820snjoywMM+ci4exFkMIuigjAZABuys6kajqafJXP5DRyrPgs0BL8k2H70Bn9CPRgC4RFU8A004LpG0KjOUkByLSBKyrTy5DYvE93pqQXnZ9X6FgwMpfw2hlMuwjHpdHqHaJ8qUgOAIt+1Qfs/0Y9J1w3qLdQRrBo4fM/2NX1FE1YV4k86WpSDc+aBns0lzNXuJGUZQzY+syEmKlYs19PpctOIyM50+TfIzD/zSCqxMLUB6w== 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=F2Pgmyge4hm5nprbUbijNyWyLyEh3WTcKvx+uILvZmA=; b=CT5RZ6NRnKAT86m6g/igwPgu2RCxsFVejNghq/xlU/0lGWQQXeaBiH9uTUkEa1POqO0jCZDQT4A6NSUSQObSs6FzfAfGcZWFJEZGOxspe70944tY2tmKsVJPFsh1pAx3efM9ZMmUQjfJugFVekxnu5avJUtowc8VPXIrheLoPMRCHQyFkUs14yX1sohv6dQ5hc368Np26D1ACsqEtPW3GE9OIFpOFvubLB8vObcYmq+OWinVdc7XO9F85TBqVWZGAp3N9mZii0i6byikJ3d8idn+SVobQd1SczmRz+uNJ4H5fnRQDrzTETSSZhdsO1tvLe3p3cKG4EKGNmkNR7RrNg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 194.138.21.71) smtp.rcpttodomain=lists.denx.de smtp.mailfrom=siemens.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=siemens.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=siemens.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=F2Pgmyge4hm5nprbUbijNyWyLyEh3WTcKvx+uILvZmA=; b=efQzDufkduYpypL94WpQCD1Q/U1njD0tIxVf14CZgw6YoVNmWPbqhEmvpHE5HZ9QNs7cy/e8BbblyfLtNodGqUyAVHtd0iGYFdeRen7QFepuGvw7y3nBlF4BhqEWZryuoOPyPjGGzkEYgtQkl85Qk9qldqaAzYr3RqVRjl5KPzKFMxc0GvXNii54qNDtKPq+hvDUdAc3IEfAVnYS6Y/qZ9Tem5Jvpwjduy4w2cn8DrF4NOG0HNffnzYRXUcEe6hfW3+x2jyEY1RKdHX6JDhiXmxDwoDwlBtn2SIwKrxG2/BdyZUqhnfJJ6lr3ADXA4p4XZ/J3CxnarEXwX/uxTZn8A== Received: from DB3PR08CA0018.eurprd08.prod.outlook.com (2603:10a6:8::31) by AM6PR10MB2325.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:44::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.25; Wed, 2 Mar 2022 14:02:28 +0000 Received: from DB5EUR01FT059.eop-EUR01.prod.protection.outlook.com (2603:10a6:8:0:cafe::5a) by DB3PR08CA0018.outlook.office365.com (2603:10a6:8::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14 via Frontend Transport; Wed, 2 Mar 2022 14:02:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 194.138.21.71) smtp.mailfrom=siemens.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=siemens.com; Received-SPF: Pass (protection.outlook.com: domain of siemens.com designates 194.138.21.71 as permitted sender) receiver=protection.outlook.com; client-ip=194.138.21.71; helo=hybrid.siemens.com; Received: from hybrid.siemens.com (194.138.21.71) by DB5EUR01FT059.mail.protection.outlook.com (10.152.4.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5038.14 via Frontend Transport; Wed, 2 Mar 2022 14:02:27 +0000 Received: from DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) by DEMCHDC9SKA.ad011.siemens.net (194.138.21.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.18; Wed, 2 Mar 2022 15:02:27 +0100 Received: from md1q0hnc.ad001.siemens.net (167.87.72.105) by DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.18; Wed, 2 Mar 2022 15:02:26 +0100 From: Jan Kiszka To: U-Boot Mailing List , Tom Rini CC: Michael Walle , Jagan Teki , , Vignesh R , , chao zeng Subject: [PATCH v6 1/2] mtd: spi: Convert is_locked callback to is_unlocked Date: Wed, 2 Mar 2022 15:01:55 +0100 Message-ID: <43da49ae649892e470f93efd4cba28e1cbdb2078.1646229716.git.jan.kiszka@siemens.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [167.87.72.105] X-ClientProxiedBy: DEMCHDC8A1A.ad011.siemens.net (139.25.226.107) To DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d7c7519d-1c15-4ad0-74f5-08d9fc554904 X-MS-TrafficTypeDiagnostic: AM6PR10MB2325:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dt6KkoGB1TTXcmXOR1lGIfbvMW3PJKUFE+OT/2c2n+c4pllDk3zYaZHxp/j4S7vjbC2OOyIB0ZEwz2+NxdIYEsIdT70yTrj5jenCCYLmD6Q9ap/YC5cLhzBbIlTJLb6M5f1n4dPdHkJ/TJhxP2PXwKSvQ8kP5WGl+f/GE+3ijHP+A7O0c2UPiH7GmxdnK3HlR34OlC0wSJgVn8k7x5f0brpju8l5SttuaNivJuFf5m1j9dPoGPRVMQfLQSFYsqS0Qhx1ustDRqaT85V+ICme4YXGJbsLwdJWJRlVGI9T1xT3SyGNdV1SflJ8kWgcpLJvujbCHtE49HoDA3JiMpZScDqOBCwav16e8IBZE+ig0UuS1z3OAOucz0Vec0f6t4mgxUSsTICfTI8g4lzXzK18m1KfmjSJvpvLna863VbUN/kpMPKc5bp1qbwa2z8/LVgD9gFV+Ko/EDemTGoMp2yXC3LnBBbDPEK3PF+Z9apJHsiCfQstWns4usWspw+AN8Us22zGLaIGohTvXBWUTD22ubYbzwN9i70UHa/p+xm5YK69CtV6jYnOCW6CQhpDfkhWzY9GU13sTB0da++JKN7GL4+FzKeuibT2M11A7295gmAAN7STEOyNvr1jRPfBYS0Sfg4QENO6EXagi7bzwsXAsrt17R/a/P0a5yRsVeu2ifqmYNbqV0m/ma6LKeb+sHPOwS6eljYfrPCLU9U5aZIgEg== X-Forefront-Antispam-Report: CIP:194.138.21.71; CTRY:DE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:hybrid.siemens.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(6666004)(508600001)(4326008)(36860700001)(8936002)(47076005)(70586007)(40460700003)(8676002)(70206006)(36756003)(186003)(82960400001)(5660300002)(956004)(26005)(336012)(16526019)(2616005)(86362001)(81166007)(356005)(82310400004)(44832011)(83380400001)(316002)(107886003)(2906002)(54906003)(110136005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: siemens.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2022 14:02:27.6459 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d7c7519d-1c15-4ad0-74f5-08d9fc554904 X-MS-Exchange-CrossTenant-Id: 38ae3bcd-9579-4fd4-adda-b42e1495d55a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=38ae3bcd-9579-4fd4-adda-b42e1495d55a; Ip=[194.138.21.71]; Helo=[hybrid.siemens.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR01FT059.eop-EUR01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR10MB2325 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean From: Jan Kiszka There was no user of this callback after 5b66fdb29dc3 anymore, and its semantic as now inconsistent between stm and sst26. What we need for the upcoming new usecase is a "completely unlocked" semantic. So consolidate over this. Signed-off-by: Jan Kiszka --- drivers/mtd/spi/spi-nor-core.c | 26 +++++++++++++------------- include/linux/mtd/spi-nor.h | 6 +++--- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index a70fbda4bbc..74aa7fc4b58 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -1308,13 +1308,13 @@ static int stm_unlock(struct spi_nor *nor, loff_t ofs, uint64_t len) } /* - * Check if a region of the flash is (completely) locked. See stm_lock() for + * Check if a region of the flash is (completely) unlocked. See stm_lock() for * more info. * - * Returns 1 if entire region is locked, 0 if any portion is unlocked, and + * Returns 1 if entire region is unlocked, 0 if any portion is locked, and * negative on errors. */ -static int stm_is_locked(struct spi_nor *nor, loff_t ofs, uint64_t len) +static int stm_is_unlocked(struct spi_nor *nor, loff_t ofs, uint64_t len) { int status; @@ -1322,7 +1322,7 @@ static int stm_is_locked(struct spi_nor *nor, loff_t ofs, uint64_t len) if (status < 0) return status; - return stm_is_locked_sr(nor, ofs, len, status); + return stm_is_unlocked_sr(nor, ofs, len, status); } #endif /* CONFIG_SPI_FLASH_STMICRO */ @@ -1555,16 +1555,16 @@ static int sst26_lock(struct spi_nor *nor, loff_t ofs, uint64_t len) } /* - * Returns EACCES (positive value) if region is locked, 0 if region is unlocked, - * and negative on errors. + * Returns EACCES (positive value) if region is (partially) locked, 0 if region + * is completely unlocked, and negative on errors. */ -static int sst26_is_locked(struct spi_nor *nor, loff_t ofs, uint64_t len) +static int sst26_is_unlocked(struct spi_nor *nor, loff_t ofs, uint64_t len) { /* - * is_locked function is used for check before reading or erasing flash - * region, so offset and length might be not 64k allighned, so adjust - * them to be 64k allighned as sst26_lock_ctl works only with 64k - * allighned regions. + * is_unlocked function is used for check before reading or erasing + * flash region, so offset and length might be not 64k aligned, so + * adjust them to be 64k aligned as sst26_lock_ctl works only with 64k + * aligned regions. */ ofs -= ofs & (SZ_64K - 1); len = len & (SZ_64K - 1) ? (len & ~(SZ_64K - 1)) + SZ_64K : len; @@ -3785,7 +3785,7 @@ int spi_nor_scan(struct spi_nor *nor) info->flags & SPI_NOR_HAS_LOCK) { nor->flash_lock = stm_lock; nor->flash_unlock = stm_unlock; - nor->flash_is_locked = stm_is_locked; + nor->flash_is_unlocked = stm_is_unlocked; } #endif @@ -3797,7 +3797,7 @@ int spi_nor_scan(struct spi_nor *nor) if (info->flags & SPI_NOR_HAS_SST26LOCK) { nor->flash_lock = sst26_lock; nor->flash_unlock = sst26_unlock; - nor->flash_is_locked = sst26_is_locked; + nor->flash_is_unlocked = sst26_is_unlocked; } #endif diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h index 4ceeae623de..f857a94db71 100644 --- a/include/linux/mtd/spi-nor.h +++ b/include/linux/mtd/spi-nor.h @@ -506,8 +506,8 @@ struct spi_flash { * spi-nor will send the erase opcode via write_reg() * @flash_lock: [FLASH-SPECIFIC] lock a region of the SPI NOR * @flash_unlock: [FLASH-SPECIFIC] unlock a region of the SPI NOR - * @flash_is_locked: [FLASH-SPECIFIC] check if a region of the SPI NOR is - * completely locked + * @flash_is_unlocked: [FLASH-SPECIFIC] check if a region of the SPI NOR is + * completely unlocked * @quad_enable: [FLASH-SPECIFIC] enables SPI NOR quad mode * @octal_dtr_enable: [FLASH-SPECIFIC] enables SPI NOR octal DTR mode. * @ready: [FLASH-SPECIFIC] check if the flash is ready @@ -556,7 +556,7 @@ struct spi_nor { int (*flash_lock)(struct spi_nor *nor, loff_t ofs, uint64_t len); int (*flash_unlock)(struct spi_nor *nor, loff_t ofs, uint64_t len); - int (*flash_is_locked)(struct spi_nor *nor, loff_t ofs, uint64_t len); + int (*flash_is_unlocked)(struct spi_nor *nor, loff_t ofs, uint64_t len); int (*quad_enable)(struct spi_nor *nor); int (*octal_dtr_enable)(struct spi_nor *nor); int (*ready)(struct spi_nor *nor); -- 2.34.1