Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp909788ybm; Wed, 22 May 2019 13:45:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqzpfKAE5XF3qEkrfqiPx9/jDeX5CmhLgbVGU3yokCGg8xM8L3wiwxSrGf6S6OKpfQV80jQK X-Received: by 2002:a62:5581:: with SMTP id j123mr99012371pfb.102.1558557939349; Wed, 22 May 2019 13:45:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558557939; cv=none; d=google.com; s=arc-20160816; b=E3cWFUa5GFoASZ6luDO55D5ScWtHjLYgw7o+8prj6wQluSdcZ2lzipMgWgUDbl51PQ oHx8oCifxd8Je/MWisvnAlb/xXoMvtJ9LSkkdkjG4rrEDzHA7x7A5ftw7hTtGC7jW1l0 wZRdvYSZ7J9cIlid8T/btapupeFHRFQP9fM5tzzOtP7I0qiGLWG1NWX3UbqFyWhdJQj3 d+O3PP6JPH+bS6+78SSyCwVTUWQaIXRL9fQ9D7B3g2lNmj/2LxvL2jUoR7Cp8SLFtazO DJxXfqE9yCECk/TRBToaX65Bn0v8Kmm5OEUP8Uv2n5Bjy3rb5KVNn3URTkdoI7U1LbYY 5yUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=esU+3qm17qrDuexe7jxN3EvAQX5MaY6ZoatueVdr3qQ=; b=P24IrRYdk5nZDpHS7n+/nicUDsBL2FD0TT6YFb5jvGVrnCFsM+yVhCfbZYAJu8oQ2z aotBvy1Oi+x066Px0SEAYvjHKeWVWo3nVHzX+q9vELTHe3sG85U31EiUknb6h9u26nsm RtSbsnFXXrp18xKeejfhabzweqFJRKq3LFyYNjSLnhJxRicdeRseghGr+zSgtTLsblzD ZiRqpfp8JMpBOe1zo17sbsVxgkL8iU/8s3dG2gSSXnTofr0AblR7XiXRDCqseI06bg4i Z8pHWGc+Jf5DAl3/tS7WXq+b+bnIHzHiYQSq52HfJKum1p+E+XE1Tcg6Uq19BP5VcXFH 6U+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LQwYJghn; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b17si23783658pfi.32.2019.05.22.13.45.23; Wed, 22 May 2019 13:45:39 -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=@gmail.com header.s=20161025 header.b=LQwYJghn; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729961AbfEVUoV (ORCPT + 99 others); Wed, 22 May 2019 16:44:21 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:45303 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729720AbfEVUoV (ORCPT ); Wed, 22 May 2019 16:44:21 -0400 Received: by mail-wr1-f67.google.com with SMTP id b18so3747530wrq.12 for ; Wed, 22 May 2019 13:44:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=esU+3qm17qrDuexe7jxN3EvAQX5MaY6ZoatueVdr3qQ=; b=LQwYJghnsjhn591pkI1Li/RiGNLgcSIn+RKzEdMKdpMhy1XZToSM64anUNI9+saxK3 ODHzCEFRE5XfoiS1p/TWCDYIthlUJIhYCafNd+cdkCt2FHwqrVkiDp1/srtU/+1359CV txZ5+WP6U+hiEJJHvBwIkHWRUKq/irVsr5+R2jyPac2VWFSABPEyi5GqcVp9/rAyKqud ivB+KBcPmscp8HxxBctoQj2bYm+rDsp9FShbnqUrka9POWYktrtNnuaqc+BEt9Mv5EM0 CAGc29oBeJM56ZBnDgN2BCx4SrVkMck8aau30uIDwDZj6xI93LaWCiQSkJ4iIVp7cDgu c60Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=esU+3qm17qrDuexe7jxN3EvAQX5MaY6ZoatueVdr3qQ=; b=MT0MqaR6eoq+HDy2K3WOMTlZZk8JZ51HHX8KJT+QiDuW0aWmW3iNwPUY1Y9k5g6oNv BS+jTscHId97Z4kKgq7ANy3myKhQimS0dIjvGSGyzX9q+yJcAlBncvUUud1oTXIKbejc nxc41lGIEwuOol1/dZK12rv6M+GvCPG6oofRTcNgTiAvNPT2JwK91/6cS5awOEkFRrl0 74lweYoPMPCS6cZ4H9UbBX1/C2cW0mdVA6nH8b+L9QAxO36Y4MSQsd40KZRMiF55LE3u V2YVnYtGcCzGWL//WIzh0amUnsMLjm77XdgwKzICZkWRp8eSoFDazVbEL5Az8u1kzGgK kWTw== X-Gm-Message-State: APjAAAXDcpTkdXUiDP9CplF85anmmGqPP7sUVdTtKmP0W8QrncPlMTZO LMDRczA7BzjCULxXyIerB52VjLTYGcqT6cYHGjI= X-Received: by 2002:a5d:4e09:: with SMTP id p9mr11738017wrt.218.1558557859722; Wed, 22 May 2019 13:44:19 -0700 (PDT) MIME-Version: 1.0 References: <20190522000753.13300-1-chris.packham@alliedtelesis.co.nz> <20190522000753.13300-2-chris.packham@alliedtelesis.co.nz> In-Reply-To: <20190522000753.13300-2-chris.packham@alliedtelesis.co.nz> From: Richard Weinberger Date: Wed, 22 May 2019 22:44:08 +0200 Message-ID: Subject: Re: [PATCH 2/2] mtd: concat: implement _is_locked mtd operation To: Chris Packham Cc: David Woodhouse , Brian Norris , Marek Vasut , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , linux-mtd@lists.infradead.org, LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 22, 2019 at 2:08 AM Chris Packham wrote: > > Add an implementation of the _is_locked operation for concatenated mtd > devices. As with concat_lock/concat_unlock this can simply use the > common helper and pass mtd_is_locked as the operation. > > Signed-off-by: Chris Packham > --- > drivers/mtd/mtdconcat.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c > index 9514cd2db63c..0e919f3423af 100644 > --- a/drivers/mtd/mtdconcat.c > +++ b/drivers/mtd/mtdconcat.c > @@ -496,6 +496,11 @@ static int concat_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) > return __concat_xxlock(mtd, ofs, len, mtd_unlock); > } > > +static int concat_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len) > +{ > + return __concat_xxlock(mtd, ofs, len, mtd_is_locked); > +} Hmm, here you start abusing your own new API. :( Did you verify that the unlock/lock-functions deal correctly with all semantics from mtd_is_locked? i.e. mtd_is_locked() with len = 0 returns 1 for spi-nor.