Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4559998ybv; Mon, 17 Feb 2020 01:23:31 -0800 (PST) X-Google-Smtp-Source: APXvYqzziAFyMHBNlfp20Y6JfJaypKFLEsEbyi4PTyq0zPWIAxWg7zAQQwd/pmKXaqXEO4cXp8bp X-Received: by 2002:aca:1913:: with SMTP id l19mr8851103oii.47.1581931411470; Mon, 17 Feb 2020 01:23:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581931411; cv=none; d=google.com; s=arc-20160816; b=tcJ2UQRpjITcQVkg+L6gAq/RJOSp9adQpKUUlnTOZCTdUPq75pBggACqXFR2KSR5ry hQZn8jY9/IUdgvsgzpMkBhJEJtYDCAKkd6LW1QRz6N3lLCpulVDndaTtCKtjK189faX1 PD1b235HaNhNxdGtY3ZzChkkc9IJtEI4hc0DJ7Ar/5IufRYygWCyu+azzDabhi1TkPRZ qm+J9Ft5hk4mLlxriNUhY2hwqs3lzeuJW7ZT/tz6khLXSPBEKsZNbK706ly3hlSugzGN ZDD8lgx4f5cnv10sQELdP0jaWXo7LySqZfaNpgDW+dqhXisgskCsn61tZYxg6Opiqg9A wapQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=vJHN7EI9RibRbZP+4m/RjNkOP0BukRWM0qIjUXlupFo=; b=iicwQ8lF5k80qNE8opZe5mXm4qhq2F6lY3O2LZDnchI1sEysNVmJchiPsHEsUl289L qbZdy5feO10h13c/njtWtgbGiR1yuQLQDTCDfhuA+ICJardHsmhQXOt9HAdw8LuU4PFO I2rcW3K+aEtjABbl9ROcNK64zTwZBP1HvPnOURRbw0rCMDuxBv0HmvKoZXwiQhTOuT4z 4i8niyIFD8QF9nKoPYBqCQ0JMb+aaEc+Ibo0CHTXeioPv4pAgOZ9d9Rganeg7SpymHb+ MlfmK/81QPIJ2N+gx7ZKGA841OjGmGjuwy5YPzuClae3iz5v0mtDjrp4XEmmRksPC5Zm wDnw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 5si6832937otm.88.2020.02.17.01.23.19; Mon, 17 Feb 2020 01:23:31 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728812AbgBQJWg (ORCPT + 99 others); Mon, 17 Feb 2020 04:22:36 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:37832 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728272AbgBQJWg (ORCPT ); Mon, 17 Feb 2020 04:22:36 -0500 Received: from localhost (unknown [IPv6:2a01:e0a:2c:6930:5cf4:84a1:2763:fe0d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bbrezillon) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 0897F28BDB9; Mon, 17 Feb 2020 09:22:34 +0000 (GMT) Date: Mon, 17 Feb 2020 10:22:30 +0100 From: Boris Brezillon To: Miquel Raynal Cc: masonccyang@mxic.com.tw, bbrezillon@kernel.org, computersforpeace@gmail.com, dwmw2@infradead.org, juliensu@mxic.com.tw, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, marek.vasut@gmail.com, richard@nod.at, vigneshr@ti.com Subject: Re: [PATCH v2 1/4] mtd: rawnand: Add support manufacturer specific lock/unlock operatoin Message-ID: <20200217102230.5dfd36e3@collabora.com> In-Reply-To: <20200217100124.6ff71191@xps13> References: <1572256527-5074-1-git-send-email-masonccyang@mxic.com.tw> <1572256527-5074-2-git-send-email-masonccyang@mxic.com.tw> <20200109203055.2370a358@collabora.com> <20200217100124.6ff71191@xps13> Organization: Collabora X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 17 Feb 2020 10:01:24 +0100 Miquel Raynal wrote: > Hi Mason, > > masonccyang@mxic.com.tw wrote on Mon, 17 Feb 2020 16:14:23 +0800: > > > Hi Boris, > > > > > > > > > /* Set default functions */ > > > > static void nand_set_defaults(struct nand_chip *chip) > > > > { > > > > @@ -5782,8 +5810,8 @@ static int nand_scan_tail(struct nand_chip > > *chip) > > > > mtd->_read_oob = nand_read_oob; > > > > mtd->_write_oob = nand_write_oob; > > > > mtd->_sync = nand_sync; > > > > - mtd->_lock = NULL; > > > > - mtd->_unlock = NULL; > > > > + mtd->_lock = nand_lock; > > > > + mtd->_unlock = nand_unlock; > > > > mtd->_suspend = nand_suspend; > > > > mtd->_resume = nand_resume; > > > > mtd->_reboot = nand_shutdown; > > > > diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h > > > > index 4ab9bcc..2430ecd 100644 > > > > --- a/include/linux/mtd/rawnand.h > > > > +++ b/include/linux/mtd/rawnand.h > > > > @@ -1136,6 +1136,9 @@ struct nand_chip { > > > > const struct nand_manufacturer *desc; > > > > void *priv; > > > > } manufacturer; > > > > + > > > > + int (*_lock)(struct nand_chip *chip, loff_t ofs, uint64_t len); > > > > + int (*_unlock)(struct nand_chip *chip, loff_t ofs, uint64_t len); > > > > > > Please drop this _ prefix. > > > > Drop _ prefix of _lock will get compile error due to there is already > > defined "struct mutex lock" in struct nand_chip. > > Right! Or maybe move all hooks to a sub-struct (struct nand_chip_ops ops). I had planned to do that in my nand_chip_legacy refactor but never did, so maybe now is a good time. > > > > > What about keep this _ prefix or patch it to blocklock/blockunlock, > > i.e., > > int (*blocklock)(struct nand_chip *chip, loff_t ofs, uint64_t len); > > int (*blockunlock)(struct nand_chip *chip, loff_t ofs, uint64_t len); > > What about lock_area() unlock_area() ? Seems more accurate to me, tell > me if I'm wrong. Yep, definitely better.