[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1435646597-7612-7-git-send-email-fabio.falzoi84@gmail.com>
Date: Tue, 30 Jun 2015 08:43:13 +0200
From: Fabio Falzoi <fabio.falzoi84@...il.com>
To: thomas.petazzoni@...e-electrons.com, noralf@...nnes.org
Cc: gregkh@...uxfoundation.org, devel@...verdev.osuosl.org,
linux-kernel@...r.kernel.org,
Fabio Falzoi <fabio.falzoi84@...il.com>
Subject: [PATCH 06/10] Staging: fbtft: Use a helper function to set set_addr_win op
Use a helper function to choose which set_addr_win implementation to
use, based on the value of the setaddrwin module parameter.
Signed-off-by: Fabio Falzoi <fabio.falzoi84@...il.com>
---
drivers/staging/fbtft/flexfb.c | 47 +++++++++++++++++++++++++-----------------
1 file changed, 28 insertions(+), 19 deletions(-)
diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c
index 1b833f9..2a15da1 100644
--- a/drivers/staging/fbtft/flexfb.c
+++ b/drivers/staging/fbtft/flexfb.c
@@ -470,6 +470,31 @@ static int flexfb_set_platform_bus_func(struct fbtft_par *par,
return 0;
}
+static int flexfb_set_addr_win_func(const struct device *dev,
+ struct fbtft_par *par)
+{
+ switch (setaddrwin) {
+ case 0:
+ /* use default */
+ break;
+ case 1:
+ par->fbtftops.set_addr_win = flexfb_set_addr_win_1;
+ break;
+ case 2:
+ par->fbtftops.set_addr_win = flexfb_set_addr_win_2;
+ break;
+ case 3:
+ par->fbtftops.set_addr_win = set_addr_win_3;
+ break;
+ default:
+ dev_err(dev, "argument 'setaddrwin': unknown value %d.\n",
+ setaddrwin);
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
static int flexfb_probe_common(struct spi_device *sdev,
struct platform_device *pdev)
{
@@ -531,25 +556,9 @@ static int flexfb_probe_common(struct spi_device *sdev,
if (ret)
goto out_release;
- /* set_addr_win function */
- switch (setaddrwin) {
- case 0:
- /* use default */
- break;
- case 1:
- par->fbtftops.set_addr_win = flexfb_set_addr_win_1;
- break;
- case 2:
- par->fbtftops.set_addr_win = flexfb_set_addr_win_2;
- break;
- case 3:
- par->fbtftops.set_addr_win = set_addr_win_3;
- break;
- default:
- dev_err(dev, "argument 'setaddrwin': unknown value %d.\n",
- setaddrwin);
- return -EINVAL;
- }
+ ret = flexfb_set_addr_win_func(dev, par);
+ if (ret)
+ goto out_release;
if (!nobacklight)
par->fbtftops.register_backlight = fbtft_register_backlight;
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists