linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amit Kumar Mahapatra <amit.kumar-mahapatra@amd.com>
To: <broonie@kernel.org>, <tudor.ambarus@linaro.org>,
	<pratyush@kernel.org>, <michael@walle.cc>,
	<miquel.raynal@bootlin.com>, <richard@nod.at>, <vigneshr@ti.com>
Cc: <git@amd.com>, <sbinding@opensource.cirrus.com>,
	<linux-spi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-mtd@lists.infradead.org>, <nicolas.ferre@microchip.com>,
	<alexandre.belloni@bootlin.com>, <claudiu.beznea@microchip.com>,
	<michal.simek@amd.com>, <linux-arm-kernel@lists.infradead.org>,
	<amitrkcian2002@gmail.com>,
	Amit Kumar Mahapatra <amit.kumar-mahapatra@amd.com>
Subject: [PATCH V7 2/7] mtd: spi-nor: Convert macros with inline functions
Date: Thu, 6 Apr 2023 12:23:31 +0530	[thread overview]
Message-ID: <20230406065336.10980-3-amit.kumar-mahapatra@amd.com> (raw)
In-Reply-To: <20230406065336.10980-1-amit.kumar-mahapatra@amd.com>

In further patches the nor->params references in
spi_nor_otp_region_len(nor) & spi_nor_otp_n_regions(nor) macros will be
replaced with spi_nor_get_params() API. To make the transition smoother,
first converting the macros into static inline functions.

Suggested-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@amd.com>
---
 drivers/mtd/spi-nor/otp.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/spi-nor/otp.c b/drivers/mtd/spi-nor/otp.c
index 00ab0d2d6d2f..3d75899de303 100644
--- a/drivers/mtd/spi-nor/otp.c
+++ b/drivers/mtd/spi-nor/otp.c
@@ -11,8 +11,27 @@
 
 #include "core.h"
 
-#define spi_nor_otp_region_len(nor) ((nor)->params->otp.org->len)
-#define spi_nor_otp_n_regions(nor) ((nor)->params->otp.org->n_regions)
+/**
+ * spi_nor_otp_region_len() - get size of one OTP region in bytes
+ * @nor:        pointer to 'struct spi_nor'
+ *
+ * Return: size of one OTP region in bytes
+ */
+static inline unsigned int spi_nor_otp_region_len(struct spi_nor *nor)
+{
+	return nor->params->otp.org->len;
+}
+
+/**
+ * spi_nor_otp_n_regions() - get number of individual OTP regions
+ * @nor:        pointer to 'struct spi_nor'
+ *
+ * Return: number of individual OTP regions
+ */
+static inline unsigned int spi_nor_otp_n_regions(struct spi_nor *nor)
+{
+	return nor->params->otp.org->n_regions;
+}
 
 /**
  * spi_nor_otp_read_secr() - read security register
-- 
2.17.1


  parent reply	other threads:[~2023-04-06  6:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-06  6:53 [PATCH V7 0/7] spi: Add support for stacked/parallel memories Amit Kumar Mahapatra
2023-04-06  6:53 ` [PATCH V7 1/7] spi: Add stacked and parallel memories support in SPI core Amit Kumar Mahapatra
2023-04-06 13:43   ` Stefan Binding
2023-04-11  9:07     ` Mahapatra, Amit Kumar
2023-04-12 15:03       ` Stefan Binding
2023-04-20  9:04         ` Mahapatra, Amit Kumar
2023-04-25 12:20           ` Stefan Binding
2023-04-27 17:09             ` Mahapatra, Amit Kumar
2023-04-28 14:08               ` Stefan Binding
2023-05-02 11:40                 ` Mahapatra, Amit Kumar
2023-05-09 16:17                   ` Stefan Binding
2023-04-06  6:53 ` Amit Kumar Mahapatra [this message]
2023-04-06  6:53 ` [PATCH V7 3/7] mtd: spi-nor: Add APIs to set/get nor->params Amit Kumar Mahapatra
2023-04-06  6:53 ` [PATCH V7 4/7] mtd: spi-nor: Add stacked memories support in spi-nor Amit Kumar Mahapatra
2023-04-06  6:53 ` [PATCH V7 5/7] spi: spi-zynqmp-gqspi: Add stacked memories support in GQSPI driver Amit Kumar Mahapatra
2023-04-06  6:53 ` [PATCH V7 6/7] mtd: spi-nor: Add parallel memories support in spi-nor Amit Kumar Mahapatra
2023-04-06  6:53 ` [PATCH V7 7/7] spi: spi-zynqmp-gqspi: Add parallel memories support in GQSPI driver Amit Kumar Mahapatra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230406065336.10980-3-amit.kumar-mahapatra@amd.com \
    --to=amit.kumar-mahapatra@amd.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=amitrkcian2002@gmail.com \
    --cc=broonie@kernel.org \
    --cc=claudiu.beznea@microchip.com \
    --cc=git@amd.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=michael@walle.cc \
    --cc=michal.simek@amd.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=nicolas.ferre@microchip.com \
    --cc=pratyush@kernel.org \
    --cc=richard@nod.at \
    --cc=sbinding@opensource.cirrus.com \
    --cc=tudor.ambarus@linaro.org \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).