All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Yogesh Narayan Gaur <yogeshnarayan.gaur@nxp.com>
Cc: "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	"marek.vasut@gmail.com" <marek.vasut@gmail.com>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"linux-spi@vger.kernel.org" <linux-spi@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"robh@kernel.org" <robh@kernel.org>,
	"mark.rutland@arm.com" <mark.rutland@arm.com>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"computersforpeace@gmail.com" <computersforpeace@gmail.com>,
	"frieder.schrempf@exceet.de" <frieder.schrempf@exceet.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH RESEND v4 1/5] spi: spi-mem: Add driver for NXP FlexSPI controller
Date: Tue, 23 Oct 2018 11:06:34 +0200	[thread overview]
Message-ID: <20181023110634.26ff2629@bbrezillon> (raw)
In-Reply-To: <1540284888-32307-2-git-send-email-yogeshnarayan.gaur@nxp.com>

On Tue, 23 Oct 2018 08:56:46 +0000
Yogesh Narayan Gaur <yogeshnarayan.gaur@nxp.com> wrote:

> +struct nxp_fspi {
> +	void __iomem *iobase;
> +	void __iomem *ahb_addr;
> +	u32 memmap_phy;
> +	u32 memmap_phy_size;
> +	struct clk *clk, *clk_en;
> +	struct device *dev;
> +	struct completion c;
> +	const struct nxp_fspi_devtype_data *devtype_data;
> +	struct mutex lock;
> +	struct pm_qos_request pm_qos_req;
> +	int selected;
> +	void (*write)(u32 val, void __iomem *addr);
> +	u32 (*read)(void __iomem *addr);

I think I already commented on this aspect, and I keep thinking having a
function pointer is overkill here.
Just declare 2 functions and do the f->devtype_data->little_endian
check in there:

static u32 fspi_readl(struct nxp_fspi *f, void __iomem *addr)
{
	if (f->devtype_data->little_endian)
		return ioread32(addr);

	return ioread32be(addr);
}

static void fspi_writel(struct nxp_fspi *f, u32 val, void __iomem *addr)
{
	if (f->devtype_data->little_endian)
		iowrite32(val, addr);

	iowrite32be(val, addr);
}

WARNING: multiple messages have this Message-ID (diff)
From: boris.brezillon@bootlin.com (Boris Brezillon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH RESEND v4 1/5] spi: spi-mem: Add driver for NXP FlexSPI controller
Date: Tue, 23 Oct 2018 11:06:34 +0200	[thread overview]
Message-ID: <20181023110634.26ff2629@bbrezillon> (raw)
In-Reply-To: <1540284888-32307-2-git-send-email-yogeshnarayan.gaur@nxp.com>

On Tue, 23 Oct 2018 08:56:46 +0000
Yogesh Narayan Gaur <yogeshnarayan.gaur@nxp.com> wrote:

> +struct nxp_fspi {
> +	void __iomem *iobase;
> +	void __iomem *ahb_addr;
> +	u32 memmap_phy;
> +	u32 memmap_phy_size;
> +	struct clk *clk, *clk_en;
> +	struct device *dev;
> +	struct completion c;
> +	const struct nxp_fspi_devtype_data *devtype_data;
> +	struct mutex lock;
> +	struct pm_qos_request pm_qos_req;
> +	int selected;
> +	void (*write)(u32 val, void __iomem *addr);
> +	u32 (*read)(void __iomem *addr);

I think I already commented on this aspect, and I keep thinking having a
function pointer is overkill here.
Just declare 2 functions and do the f->devtype_data->little_endian
check in there:

static u32 fspi_readl(struct nxp_fspi *f, void __iomem *addr)
{
	if (f->devtype_data->little_endian)
		return ioread32(addr);

	return ioread32be(addr);
}

static void fspi_writel(struct nxp_fspi *f, u32 val, void __iomem *addr)
{
	if (f->devtype_data->little_endian)
		iowrite32(val, addr);

	iowrite32be(val, addr);
}

  reply	other threads:[~2018-10-23  9:06 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-23  8:56 [PATCH RESEND v4 0/5] spi: spi-mem: Add driver for NXP FlexSPI controller Yogesh Narayan Gaur
2018-10-23  8:56 ` Yogesh Narayan Gaur
2018-10-23  8:56 ` [PATCH RESEND v4 1/5] " Yogesh Narayan Gaur
2018-10-23  8:56   ` Yogesh Narayan Gaur
2018-10-23  9:06   ` Boris Brezillon [this message]
2018-10-23  9:06     ` Boris Brezillon
2018-10-23  9:12     ` Yogesh Narayan Gaur
2018-10-23  9:12       ` Yogesh Narayan Gaur
2018-11-07 16:21   ` Schrempf Frieder
2018-11-07 16:21     ` Schrempf Frieder
2018-11-07 16:21     ` Schrempf Frieder
2018-11-13  7:04     ` Yogesh Narayan Gaur
2018-11-13  7:04       ` Yogesh Narayan Gaur
2018-11-13  7:26       ` Schrempf Frieder
2018-11-13  7:26         ` Schrempf Frieder
2018-10-23  8:56 ` [PATCH RESEND v4 2/5] dt-bindings: spi: add binding file " Yogesh Narayan Gaur
2018-10-23  8:56   ` Yogesh Narayan Gaur
2018-10-23  8:57 ` [PATCH RESEND v4 3/5] arm64: dts: lx2160a: add FlexSPI node property Yogesh Narayan Gaur
2018-10-23  8:57   ` Yogesh Narayan Gaur
2018-10-23  8:57 ` [PATCH RESEND v4 4/5] arm64: defconfig: enable NXP FlexSPI driver Yogesh Narayan Gaur
2018-10-23  8:57   ` Yogesh Narayan Gaur
2018-10-23  8:57 ` [PATCH RESEND v4 5/5] MAINTAINERS: add maintainers for the " Yogesh Narayan Gaur
2018-10-23  8:57   ` Yogesh Narayan Gaur

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=20181023110634.26ff2629@bbrezillon \
    --to=boris.brezillon@bootlin.com \
    --cc=broonie@kernel.org \
    --cc=computersforpeace@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=frieder.schrempf@exceet.de \
    --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=marek.vasut@gmail.com \
    --cc=mark.rutland@arm.com \
    --cc=robh@kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=yogeshnarayan.gaur@nxp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.