From: Alexander Shiyan <eagle.alexander923@gmail.com>
To: barebox@lists.infradead.org
Cc: Alexander Shiyan <eagle.alexander923@gmail.com>
Subject: [PATCH] mfd: atmel-flexcom: Driver refresh
Date: Fri, 27 Dec 2024 10:39:52 +0300 [thread overview]
Message-ID: <20241227073952.26221-1-eagle.alexander923@gmail.com> (raw)
Replace dev_request_mem_resource() with dev_platform_get_and_ioremap_resource(),
clk_get() + clk_enable() with clk_get_enabled()
and use dev_err_probe() as driver refresh.
Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
---
drivers/mfd/atmel-flexcom.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/drivers/mfd/atmel-flexcom.c b/drivers/mfd/atmel-flexcom.c
index 58e94c4889..11daeafc5f 100644
--- a/drivers/mfd/atmel-flexcom.c
+++ b/drivers/mfd/atmel-flexcom.c
@@ -22,7 +22,7 @@
static int atmel_flexcom_probe(struct device *dev)
{
- struct resource *res;
+ void __iomem *base;
struct clk *clk;
u32 opmode;
int err;
@@ -35,17 +35,13 @@ static int atmel_flexcom_probe(struct device *dev)
if (opmode < ATMEL_FLEXCOM_MODE_USART || opmode > ATMEL_FLEXCOM_MODE_TWI)
return -EINVAL;
- res = dev_request_mem_resource(dev, 0);
- if (IS_ERR(res))
- return PTR_ERR(res);
+ base = dev_platform_get_and_ioremap_resource(dev, 0, NULL);
+ if (IS_ERR(base))
+ return dev_err_probe(dev, PTR_ERR(base), "Could not get memory region\n");
- clk = clk_get(dev, NULL);
+ clk = clk_get_enabled(dev, NULL);
if (IS_ERR(clk))
- return PTR_ERR(clk);
-
- err = clk_enable(clk);
- if (err)
- return err;
+ return dev_err_probe(dev, PTR_ERR(clk), "Can't get clk\n");
/*
* Set the Operating Mode in the Mode Register: only the selected device
@@ -53,7 +49,7 @@ static int atmel_flexcom_probe(struct device *dev)
* inaccessible and are read as zero. Also the external I/O lines of the
* Flexcom are muxed to reach the selected device.
*/
- writel(FLEX_MR_OPMODE(opmode), IOMEM(res->start) + FLEX_MR);
+ writel(FLEX_MR_OPMODE(opmode), base + FLEX_MR);
clk_disable(clk);
--
2.39.1
next reply other threads:[~2024-12-27 7:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-27 7:39 Alexander Shiyan [this message]
2025-01-06 9:14 ` Sascha Hauer
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=20241227073952.26221-1-eagle.alexander923@gmail.com \
--to=eagle.alexander923@gmail.com \
--cc=barebox@lists.infradead.org \
/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