Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp930319ybm; Wed, 22 May 2019 14:08:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqz6grBm9fzfz200gDN6apNdhfQcQ1SX9Y31k4VHDJx3Yq9EUUMD5c36XofwJfHsjdjl04sI X-Received: by 2002:a63:90c7:: with SMTP id a190mr94060874pge.23.1558559312453; Wed, 22 May 2019 14:08:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558559312; cv=none; d=google.com; s=arc-20160816; b=kaekvQnkKffnFsFntkYIg8IAHK/lwKRpsh9h3+ieMXoFuClWkcOQ8tIyPqqlFUkFTE zWaA8tKAYk1MrXdmC4467ihB+ZcahswneSjPHsZnAPtb7WNB0dlPxgZ8p4BoJUZ86lJ1 B1MReKNqVYMBzv6DM7iPKk2jyo1/JbH7UkXjtc0FMolon71Kp4N1fMKm5TSFmu1SBHO7 wdqTuDJvr825GCIias9TWyB1EXr1M3GjOqKy+X2/lGzT1jKyle3brfd/DlonXEpcLkmG E9xfz7RnH6znK87h4FtDs70sYj1sWAMDhP1RqWQPCySFqSZj9hdicTws63nP912a/4ib 7mtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:references:message-id:date :thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=8p35s5XVWClYRtrAwLIBY55P6drz9IsxEb7+jakkOSE=; b=Dg7jnEl3WR07WiTcBK+QJjBhPuvYzWrwnLSYTCPvmu4QoAnsDqQDfl1pNTyIV3Xg1b qNTYBXYX5UY3is9yROY+Mk63ozVHvZspsV5jyBHm4TDX/uNCTyU+9dgMMn33+U9OAOPu N3NroWpOO9syEy/O0xTxKN5te7l2D3oUMeakqoK5qCyGUwrrYAa+OzfC2z/Yr6S0RbCj 8c00c1BsiDmr1I9VACPxlZMlDvXWd80osI+qgmGntxwJA9o76MaA5npyoRl0bWE3ITHj 1aS1GQkvHA2dbumBJw9pqG1AxBuzPKBh323AbNHpJNDQVStCTkmBUmj+28oYgMItMxbB 2PiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alliedtelesis.co.nz header.s=mail181024 header.b="w/FMcy8L"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alliedtelesis.co.nz Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cp18si17944279plb.196.2019.05.22.14.08.16; Wed, 22 May 2019 14:08:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@alliedtelesis.co.nz header.s=mail181024 header.b="w/FMcy8L"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alliedtelesis.co.nz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730095AbfEVVGy (ORCPT + 99 others); Wed, 22 May 2019 17:06:54 -0400 Received: from gate2.alliedtelesis.co.nz ([202.36.163.20]:38679 "EHLO gate2.alliedtelesis.co.nz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729528AbfEVVGx (ORCPT ); Wed, 22 May 2019 17:06:53 -0400 Received: from mmarshal3.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id 721EB886BF for ; Thu, 23 May 2019 09:06:49 +1200 (NZST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail181024; t=1558559209; bh=8p35s5XVWClYRtrAwLIBY55P6drz9IsxEb7+jakkOSE=; h=From:To:CC:Subject:Date:References; b=w/FMcy8LrCkP7/k1jhsMg6PjVW5Yf3xubMEg37maZ+K8yhuJsWQSxFV9ARFjjfU7n pSM13x6MhgVkg5CBWS27fnOk6e4qOp4HHUQt+FlQe1X7DpIWHcVTzol0/Jvl3SKC+r zaEgjZ7d4eWhmSu748gxfZjpyn6JR1SV7o+Y/MVcWho4ldU3qmVkEaz4MenDvuMPtz SV2B8Vb3NfXIXboQcXgoCiut3aSvfyyGQsQbh/wEm4EkJArmM2EkvaSGnJUGTQK9kd QOHrnVvCaFFFrv9bF/pJSoHj/gSJL2cnLTRMnfz71Qv8X2K3RB60cuNalM1FBzKpuY 1U1KOJU+w5i+Q== Received: from svr-chch-ex1.atlnz.lc (Not Verified[10.32.16.77]) by mmarshal3.atlnz.lc with Trustwave SEG (v7,5,8,10121) id ; Thu, 23 May 2019 09:06:47 +1200 Received: from svr-chch-ex1.atlnz.lc (2001:df5:b000:bc8:409d:36f5:8899:92e8) by svr-chch-ex1.atlnz.lc (2001:df5:b000:bc8:409d:36f5:8899:92e8) with Microsoft SMTP Server (TLS) id 15.0.1156.6; Thu, 23 May 2019 09:06:49 +1200 Received: from svr-chch-ex1.atlnz.lc ([fe80::409d:36f5:8899:92e8]) by svr-chch-ex1.atlnz.lc ([fe80::409d:36f5:8899:92e8%12]) with mapi id 15.00.1156.000; Thu, 23 May 2019 09:06:49 +1200 From: Chris Packham To: Richard Weinberger CC: David Woodhouse , Brian Norris , Marek Vasut , "Miquel Raynal" , Richard Weinberger , Vignesh Raghavendra , "linux-mtd@lists.infradead.org" , LKML Subject: Re: [PATCH 2/2] mtd: concat: implement _is_locked mtd operation Thread-Topic: [PATCH 2/2] mtd: concat: implement _is_locked mtd operation Thread-Index: AQHVEDJo0iBq93PH/EeJquPgUtfeew== Date: Wed, 22 May 2019 21:06:48 +0000 Message-ID: <0c59bcd6c866429cb9727f787b7f61ce@svr-chch-ex1.atlnz.lc> References: <20190522000753.13300-1-chris.packham@alliedtelesis.co.nz> <20190522000753.13300-2-chris.packham@alliedtelesis.co.nz> Accept-Language: en-NZ, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [2001:df5:b000:22:3a2c:4aff:fe70:2b02] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23/05/19 8:44 AM, Richard Weinberger wrote:=0A= > On Wed, May 22, 2019 at 2:08 AM Chris Packham=0A= > wrote:=0A= >>=0A= >> Add an implementation of the _is_locked operation for concatenated mtd= =0A= >> devices. As with concat_lock/concat_unlock this can simply use the=0A= >> common helper and pass mtd_is_locked as the operation.=0A= >>=0A= >> Signed-off-by: Chris Packham =0A= >> ---=0A= >> drivers/mtd/mtdconcat.c | 6 ++++++=0A= >> 1 file changed, 6 insertions(+)=0A= >>=0A= >> diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c=0A= >> index 9514cd2db63c..0e919f3423af 100644=0A= >> --- a/drivers/mtd/mtdconcat.c=0A= >> +++ b/drivers/mtd/mtdconcat.c=0A= >> @@ -496,6 +496,11 @@ static int concat_unlock(struct mtd_info *mtd, loff= _t ofs, uint64_t len)=0A= >> return __concat_xxlock(mtd, ofs, len, mtd_unlock);=0A= >> }=0A= >>=0A= >> +static int concat_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t = len)=0A= >> +{=0A= >> + return __concat_xxlock(mtd, ofs, len, mtd_is_locked);=0A= >> +}=0A= > =0A= > Hmm, here you start abusing your own new API. :(=0A= =0A= Abusing because xxlock is a poor choice of name? I initially had a third = =0A= copy of the logic from lock/unlock which is what lead me to do the =0A= cleanup first. mtd_lock(), mtd_unlock() and mtd_is_locked() all work the = =0A= same way namely given an offset and a length either lock, unlock or =0A= return the status of the len/erasesz blocks at ofs.=0A= =0A= > =0A= > Did you verify that the unlock/lock-functions deal correctly with all=0A= > semantics from mtd_is_locked?=0A= > i.e. mtd_is_locked() with len =3D 0 returns 1 for spi-nor.=0A= > =0A= =0A= I believe so. I've only got access to a parallel NOR flash system that =0A= uses concatenation and that seems sane (is mtdconcat able to work with =0A= spi memories?). The concat_is_locked() should just reflect what the =0A= underlying mtd device driver returns.=0A=