2021-01-19 22:11:35

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 01/14] rtc: ac100: use rtc_lock/rtc_unlock

Avoid accessing directly rtc->ops_lock and use the RTC core helpers.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-ac100.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-ac100.c b/drivers/rtc/rtc-ac100.c
index 1ddbef99e38f..92f690542ad2 100644
--- a/drivers/rtc/rtc-ac100.c
+++ b/drivers/rtc/rtc-ac100.c
@@ -528,7 +528,7 @@ static irqreturn_t ac100_rtc_irq(int irq, void *data)
unsigned int val = 0;
int ret;

- mutex_lock(&chip->rtc->ops_lock);
+ rtc_lock(&chip->rtc);

/* read status */
ret = regmap_read(regmap, AC100_ALM_INT_STA, &val);
@@ -551,7 +551,7 @@ static irqreturn_t ac100_rtc_irq(int irq, void *data)
}

out:
- mutex_unlock(&chip->rtc->ops_lock);
+ rtc_unlock(&chip->rtc);
return IRQ_HANDLED;
}

--
2.29.2


2021-01-19 22:11:44

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 08/14] rtc: m41t80: use rtc_lock/rtc_unlock

Avoid accessing directly rtc->ops_lock and use the RTC core helpers.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-m41t80.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c
index e3ddd660d68c..ee0c1be0354e 100644
--- a/drivers/rtc/rtc-m41t80.c
+++ b/drivers/rtc/rtc-m41t80.c
@@ -158,21 +158,20 @@ static irqreturn_t m41t80_handle_irq(int irq, void *dev_id)
{
struct i2c_client *client = dev_id;
struct m41t80_data *m41t80 = i2c_get_clientdata(client);
- struct mutex *lock = &m41t80->rtc->ops_lock;
unsigned long events = 0;
int flags, flags_afe;

- mutex_lock(lock);
+ rtc_lock(m41t80->rtc);

flags_afe = i2c_smbus_read_byte_data(client, M41T80_REG_ALARM_MON);
if (flags_afe < 0) {
- mutex_unlock(lock);
+ rtc_unlock(m41t80->rtc);
return IRQ_NONE;
}

flags = i2c_smbus_read_byte_data(client, M41T80_REG_FLAGS);
if (flags <= 0) {
- mutex_unlock(lock);
+ rtc_unlock(m41t80->rtc);
return IRQ_NONE;
}

@@ -189,7 +188,7 @@ static irqreturn_t m41t80_handle_irq(int irq, void *dev_id)
flags_afe);
}

- mutex_unlock(lock);
+ rtc_unlock(m41t80->rtc);

return IRQ_HANDLED;
}
--
2.29.2

2021-01-19 22:11:51

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 04/14] rtc: ds1307: use rtc_lock/rtc_unlock

Avoid accessing directly rtc->ops_lock and use the RTC core helpers.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-ds1307.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 183cf7c01364..cd8e438bc9c4 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -558,11 +558,10 @@ static u8 do_trickle_setup_rx8130(struct ds1307 *ds1307, u32 ohms, bool diode)
static irqreturn_t rx8130_irq(int irq, void *dev_id)
{
struct ds1307 *ds1307 = dev_id;
- struct mutex *lock = &ds1307->rtc->ops_lock;
u8 ctl[3];
int ret;

- mutex_lock(lock);
+ rtc_lock(ds1307->rtc);

/* Read control registers. */
ret = regmap_bulk_read(ds1307->regmap, RX8130_REG_EXTENSION, ctl,
@@ -582,7 +581,7 @@ static irqreturn_t rx8130_irq(int irq, void *dev_id)
rtc_update_irq(ds1307->rtc, 1, RTC_AF | RTC_IRQF);

out:
- mutex_unlock(lock);
+ rtc_unlock(ds1307->rtc);

return IRQ_HANDLED;
}
--
2.29.2

2021-01-19 22:12:21

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 10/14] rtc: pcf2123: use rtc_lock/rtc_unlock

Avoid accessing directly rtc->ops_lock and use the RTC core helpers.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-pcf2123.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-pcf2123.c b/drivers/rtc/rtc-pcf2123.c
index 534ffc91eec1..0f58cac81d8c 100644
--- a/drivers/rtc/rtc-pcf2123.c
+++ b/drivers/rtc/rtc-pcf2123.c
@@ -307,11 +307,10 @@ static int pcf2123_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
static irqreturn_t pcf2123_rtc_irq(int irq, void *dev)
{
struct pcf2123_data *pcf2123 = dev_get_drvdata(dev);
- struct mutex *lock = &pcf2123->rtc->ops_lock;
unsigned int val = 0;
int ret = IRQ_NONE;

- mutex_lock(lock);
+ rtc_lock(pcf2123->rtc);
regmap_read(pcf2123->map, PCF2123_REG_CTRL2, &val);

/* Alarm? */
@@ -324,7 +323,7 @@ static irqreturn_t pcf2123_rtc_irq(int irq, void *dev)
rtc_update_irq(pcf2123->rtc, 1, RTC_IRQF | RTC_AF);
}

- mutex_unlock(lock);
+ rtc_unlock(pcf2123->rtc);

return ret;
}
--
2.29.2

2021-01-19 22:12:57

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 06/14] rtc: ds3232: use rtc_lock/rtc_unlock

Avoid accessing directly rtc->ops_lock and use the RTC core helpers.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-ds3232.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c
index 16b89035d135..535e4a88fbb6 100644
--- a/drivers/rtc/rtc-ds3232.c
+++ b/drivers/rtc/rtc-ds3232.c
@@ -406,11 +406,10 @@ static irqreturn_t ds3232_irq(int irq, void *dev_id)
{
struct device *dev = dev_id;
struct ds3232 *ds3232 = dev_get_drvdata(dev);
- struct mutex *lock = &ds3232->rtc->ops_lock;
int ret;
int stat, control;

- mutex_lock(lock);
+ rtc_lock(ds3232->rtc);

ret = regmap_read(ds3232->regmap, DS3232_REG_SR, &stat);
if (ret)
@@ -448,7 +447,7 @@ static irqreturn_t ds3232_irq(int irq, void *dev_id)
}

unlock:
- mutex_unlock(lock);
+ rtc_unlock(ds3232->rtc);

return IRQ_HANDLED;
}
--
2.29.2

2021-01-19 22:13:35

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 13/14] rtc: rx8025: use rtc_lock/rtc_unlock

Avoid accessing directly rtc->ops_lock and use the RTC core helpers.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-rx8025.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-rx8025.c b/drivers/rtc/rtc-rx8025.c
index a24f85893f90..c914091819ba 100644
--- a/drivers/rtc/rtc-rx8025.c
+++ b/drivers/rtc/rtc-rx8025.c
@@ -142,10 +142,9 @@ static irqreturn_t rx8025_handle_irq(int irq, void *dev_id)
{
struct i2c_client *client = dev_id;
struct rx8025_data *rx8025 = i2c_get_clientdata(client);
- struct mutex *lock = &rx8025->rtc->ops_lock;
int status;

- mutex_lock(lock);
+ rtc_lock(rx8025->rtc);
status = rx8025_read_reg(client, RX8025_REG_CTRL2);
if (status < 0)
goto out;
@@ -170,7 +169,7 @@ static irqreturn_t rx8025_handle_irq(int irq, void *dev_id)
}

out:
- mutex_unlock(lock);
+ rtc_unlock(rx8025->rtc);

return IRQ_HANDLED;
}
--
2.29.2

2021-01-19 22:14:58

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 14/14] rtc: stm32: use rtc_lock/rtc_unlock

Avoid accessing directly rtc->ops_lock and use the RTC core helpers.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-stm32.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-stm32.c b/drivers/rtc/rtc-stm32.c
index d774aa18f57a..75a8924ba12b 100644
--- a/drivers/rtc/rtc-stm32.c
+++ b/drivers/rtc/rtc-stm32.c
@@ -209,7 +209,7 @@ static irqreturn_t stm32_rtc_alarm_irq(int irq, void *dev_id)
const struct stm32_rtc_events *evts = &rtc->data->events;
unsigned int status, cr;

- mutex_lock(&rtc->rtc_dev->ops_lock);
+ rtc_lock(rtc->rtc_dev);

status = readl_relaxed(rtc->base + regs->sr);
cr = readl_relaxed(rtc->base + regs->cr);
@@ -226,7 +226,7 @@ static irqreturn_t stm32_rtc_alarm_irq(int irq, void *dev_id)
stm32_rtc_clear_event_flags(rtc, evts->alra);
}

- mutex_unlock(&rtc->rtc_dev->ops_lock);
+ rtc_unlock(rtc->rtc_dev);

return IRQ_HANDLED;
}
--
2.29.2

2021-01-19 22:19:06

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 12/14] rtc: rx8010: use rtc_lock/rtc_unlock

Avoid accessing directly rtc->ops_lock and use the RTC core helpers.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-rx8010.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-rx8010.c b/drivers/rtc/rtc-rx8010.c
index 1a05e4654290..95e751c8048e 100644
--- a/drivers/rtc/rtc-rx8010.c
+++ b/drivers/rtc/rtc-rx8010.c
@@ -73,11 +73,11 @@ static irqreturn_t rx8010_irq_1_handler(int irq, void *dev_id)
struct rx8010_data *rx8010 = i2c_get_clientdata(client);
int flagreg, err;

- mutex_lock(&rx8010->rtc->ops_lock);
+ rtc_lock(rx8010->rtc);

err = regmap_read(rx8010->regs, RX8010_FLAG, &flagreg);
if (err) {
- mutex_unlock(&rx8010->rtc->ops_lock);
+ rtc_unlock(rx8010->rtc);
return IRQ_NONE;
}

@@ -100,7 +100,7 @@ static irqreturn_t rx8010_irq_1_handler(int irq, void *dev_id)
}

err = regmap_write(rx8010->regs, RX8010_FLAG, flagreg);
- mutex_unlock(&rx8010->rtc->ops_lock);
+ rtc_unlock(rx8010->rtc);
return err ? IRQ_NONE : IRQ_HANDLED;
}

--
2.29.2

2021-01-19 22:19:06

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 09/14] rtc: mcp795: use rtc_lock/rtc_unlock

Avoid accessing directly rtc->ops_lock and use the RTC core helpers.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-mcp795.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-mcp795.c b/drivers/rtc/rtc-mcp795.c
index 21cbf7f892e8..bad7792b6ca5 100644
--- a/drivers/rtc/rtc-mcp795.c
+++ b/drivers/rtc/rtc-mcp795.c
@@ -350,10 +350,9 @@ static irqreturn_t mcp795_irq(int irq, void *data)
{
struct spi_device *spi = data;
struct rtc_device *rtc = spi_get_drvdata(spi);
- struct mutex *lock = &rtc->ops_lock;
int ret;

- mutex_lock(lock);
+ rtc_lock(rtc);

/* Disable alarm.
* There is no need to clear ALM0IF (Alarm 0 Interrupt Flag) bit,
@@ -365,7 +364,7 @@ static irqreturn_t mcp795_irq(int irq, void *data)
"Failed to disable alarm in IRQ (ret=%d)\n", ret);
rtc_update_irq(rtc, 1, RTC_AF | RTC_IRQF);

- mutex_unlock(lock);
+ rtc_unlock(rtc);

return IRQ_HANDLED;
}
--
2.29.2

2021-01-19 22:21:09

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 11/14] rtc: rv3029: use rtc_lock/rtc_unlock

Avoid accessing directly rtc->ops_lock and use the RTC core helpers.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-rv3029c2.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/rtc/rtc-rv3029c2.c b/drivers/rtc/rtc-rv3029c2.c
index c1f4c0bba1e5..71102c7fbd7d 100644
--- a/drivers/rtc/rtc-rv3029c2.c
+++ b/drivers/rtc/rtc-rv3029c2.c
@@ -265,24 +265,23 @@ static irqreturn_t rv3029_handle_irq(int irq, void *dev_id)
{
struct device *dev = dev_id;
struct rv3029_data *rv3029 = dev_get_drvdata(dev);
- struct mutex *lock = &rv3029->rtc->ops_lock;
unsigned int flags, controls;
unsigned long events = 0;
int ret;

- mutex_lock(lock);
+ rtc_lock(rv3029->rtc);

ret = regmap_read(rv3029->regmap, RV3029_IRQ_CTRL, &controls);
if (ret) {
dev_warn(dev, "Read IRQ Control Register error %d\n", ret);
- mutex_unlock(lock);
+ rtc_unlock(rv3029->rtc);
return IRQ_NONE;
}

ret = regmap_read(rv3029->regmap, RV3029_IRQ_FLAGS, &flags);
if (ret) {
dev_warn(dev, "Read IRQ Flags Register error %d\n", ret);
- mutex_unlock(lock);
+ rtc_unlock(rv3029->rtc);
return IRQ_NONE;
}

@@ -297,7 +296,7 @@ static irqreturn_t rv3029_handle_irq(int irq, void *dev_id)
regmap_write(rv3029->regmap, RV3029_IRQ_FLAGS, flags);
regmap_write(rv3029->regmap, RV3029_IRQ_CTRL, controls);
}
- mutex_unlock(lock);
+ rtc_unlock(rv3029->rtc);

return IRQ_HANDLED;
}
--
2.29.2

2021-01-19 22:24:16

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 05/14] rtc: ds1685: use rtc_lock/rtc_unlock

Avoid accessing directly rtc->ops_lock and use the RTC core helpers.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-ds1685.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/rtc/rtc-ds1685.c b/drivers/rtc/rtc-ds1685.c
index d69c807af29b..75db7ab654a5 100644
--- a/drivers/rtc/rtc-ds1685.c
+++ b/drivers/rtc/rtc-ds1685.c
@@ -658,7 +658,6 @@ ds1685_rtc_irq_handler(int irq, void *dev_id)
{
struct platform_device *pdev = dev_id;
struct ds1685_priv *rtc = platform_get_drvdata(pdev);
- struct mutex *rtc_mutex;
u8 ctrlb, ctrlc;
unsigned long events = 0;
u8 num_irqs = 0;
@@ -667,8 +666,7 @@ ds1685_rtc_irq_handler(int irq, void *dev_id)
if (unlikely(!rtc))
return IRQ_HANDLED;

- rtc_mutex = &rtc->dev->ops_lock;
- mutex_lock(rtc_mutex);
+ rtc_lock(rtc->dev);

/* Ctrlb holds the interrupt-enable bits and ctrlc the flag bits. */
ctrlb = rtc->read(rtc, RTC_CTRL_B);
@@ -713,7 +711,7 @@ ds1685_rtc_irq_handler(int irq, void *dev_id)
}
}
rtc_update_irq(rtc->dev, num_irqs, events);
- mutex_unlock(rtc_mutex);
+ rtc_unlock(rtc->dev);

return events ? IRQ_HANDLED : IRQ_NONE;
}
--
2.29.2

2021-01-19 22:24:38

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 07/14] rtc: hym8563: use rtc_lock/rtc_unlock

Avoid accessing directly rtc->ops_lock and use the RTC core helpers.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-hym8563.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-hym8563.c b/drivers/rtc/rtc-hym8563.c
index 24e0095be058..0751cae27285 100644
--- a/drivers/rtc/rtc-hym8563.c
+++ b/drivers/rtc/rtc-hym8563.c
@@ -428,10 +428,9 @@ static irqreturn_t hym8563_irq(int irq, void *dev_id)
{
struct hym8563 *hym8563 = (struct hym8563 *)dev_id;
struct i2c_client *client = hym8563->client;
- struct mutex *lock = &hym8563->rtc->ops_lock;
int data, ret;

- mutex_lock(lock);
+ rtc_lock(hym8563->rtc);

/* Clear the alarm flag */

@@ -451,7 +450,7 @@ static irqreturn_t hym8563_irq(int irq, void *dev_id)
}

out:
- mutex_unlock(lock);
+ rtc_unlock(hym8563->rtc);
return IRQ_HANDLED;
}

--
2.29.2

2021-01-19 22:25:46

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 03/14] rtc: ds1305: use rtc_lock/rtc_unlock

Avoid accessing directly rtc->ops_lock and use the RTC core helpers.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-ds1305.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-ds1305.c b/drivers/rtc/rtc-ds1305.c
index 8c2ab29c3d91..9ef107b99b65 100644
--- a/drivers/rtc/rtc-ds1305.c
+++ b/drivers/rtc/rtc-ds1305.c
@@ -435,13 +435,12 @@ static const struct rtc_class_ops ds1305_ops = {
static void ds1305_work(struct work_struct *work)
{
struct ds1305 *ds1305 = container_of(work, struct ds1305, work);
- struct mutex *lock = &ds1305->rtc->ops_lock;
struct spi_device *spi = ds1305->spi;
u8 buf[3];
int status;

/* lock to protect ds1305->ctrl */
- mutex_lock(lock);
+ rtc_lock(ds1305->rtc);

/* Disable the IRQ, and clear its status ... for now, we "know"
* that if more than one alarm is active, they're in sync.
@@ -459,7 +458,7 @@ static void ds1305_work(struct work_struct *work)
if (status < 0)
dev_dbg(&spi->dev, "clear irq --> %d\n", status);

- mutex_unlock(lock);
+ rtc_unlock(ds1305->rtc);

if (!test_bit(FLAG_EXITING, &ds1305->flags))
enable_irq(spi->irq);
--
2.29.2

2021-01-20 17:59:43

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 01/14] rtc: ac100: use rtc_lock/rtc_unlock

Hi Alexandre,

I love your patch! Yet something to improve:

[auto build test ERROR on abelloni/rtc-next]
[also build test ERROR on stm32/stm32-next linux/master linus/master v5.11-rc4 next-20210120]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Alexandre-Belloni/rtc-ac100-use-rtc_lock-rtc_unlock/20210120-172843
base: https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: arm-sunxi_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/b6052366a7328ef9db6ad0d0fc7ea94e542a6f05
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Alexandre-Belloni/rtc-ac100-use-rtc_lock-rtc_unlock/20210120-172843
git checkout b6052366a7328ef9db6ad0d0fc7ea94e542a6f05
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

In file included from drivers/rtc/rtc-ac100.c:21:
drivers/rtc/rtc-ac100.c: In function 'ac100_rtc_irq':
>> include/linux/rtc.h:165:32: error: lvalue required as unary '&' operand
165 | #define rtc_lock(d) mutex_lock(&d->ops_lock)
| ^
drivers/rtc/rtc-ac100.c:531:2: note: in expansion of macro 'rtc_lock'
531 | rtc_lock(&chip->rtc);
| ^~~~~~~~
include/linux/rtc.h:166:36: error: lvalue required as unary '&' operand
166 | #define rtc_unlock(d) mutex_unlock(&d->ops_lock)
| ^
drivers/rtc/rtc-ac100.c:554:2: note: in expansion of macro 'rtc_unlock'
554 | rtc_unlock(&chip->rtc);
| ^~~~~~~~~~


vim +165 include/linux/rtc.h

0c86edc0d4970649 Alessandro Zummo 2006-03-27 164
ae48668843382593 Alexandre Belloni 2019-10-19 @165 #define rtc_lock(d) mutex_lock(&d->ops_lock)
ae48668843382593 Alexandre Belloni 2019-10-19 166 #define rtc_unlock(d) mutex_unlock(&d->ops_lock)
ae48668843382593 Alexandre Belloni 2019-10-19 167

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (2.64 kB)
.config.gz (28.16 kB)
Download all attachments

2021-01-25 03:36:47

by Joshua Kinard

[permalink] [raw]
Subject: Re: [PATCH 05/14] rtc: ds1685: use rtc_lock/rtc_unlock

On 1/19/2021 17:06, Alexandre Belloni wrote:
> Avoid accessing directly rtc->ops_lock and use the RTC core helpers.
>
> Signed-off-by: Alexandre Belloni <[email protected]>
> ---
> drivers/rtc/rtc-ds1685.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/rtc/rtc-ds1685.c b/drivers/rtc/rtc-ds1685.c
> index d69c807af29b..75db7ab654a5 100644
> --- a/drivers/rtc/rtc-ds1685.c
> +++ b/drivers/rtc/rtc-ds1685.c
> @@ -658,7 +658,6 @@ ds1685_rtc_irq_handler(int irq, void *dev_id)
> {
> struct platform_device *pdev = dev_id;
> struct ds1685_priv *rtc = platform_get_drvdata(pdev);
> - struct mutex *rtc_mutex;
> u8 ctrlb, ctrlc;
> unsigned long events = 0;
> u8 num_irqs = 0;
> @@ -667,8 +666,7 @@ ds1685_rtc_irq_handler(int irq, void *dev_id)
> if (unlikely(!rtc))
> return IRQ_HANDLED;
>
> - rtc_mutex = &rtc->dev->ops_lock;
> - mutex_lock(rtc_mutex);
> + rtc_lock(rtc->dev);
>
> /* Ctrlb holds the interrupt-enable bits and ctrlc the flag bits. */
> ctrlb = rtc->read(rtc, RTC_CTRL_B);
> @@ -713,7 +711,7 @@ ds1685_rtc_irq_handler(int irq, void *dev_id)
> }
> }
> rtc_update_irq(rtc->dev, num_irqs, events);
> - mutex_unlock(rtc_mutex);
> + rtc_unlock(rtc->dev);
>
> return events ? IRQ_HANDLED : IRQ_NONE;
> }
>

Acked-by: Joshua Kinard <[email protected]>

2021-01-25 22:17:07

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH v2] rtc: ac100: use rtc_lock/rtc_unlock

Avoid accessing directly rtc->ops_lock and use the RTC core helpers.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-ac100.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-ac100.c b/drivers/rtc/rtc-ac100.c
index 1ddbef99e38f..66783cb5e711 100644
--- a/drivers/rtc/rtc-ac100.c
+++ b/drivers/rtc/rtc-ac100.c
@@ -528,7 +528,7 @@ static irqreturn_t ac100_rtc_irq(int irq, void *data)
unsigned int val = 0;
int ret;

- mutex_lock(&chip->rtc->ops_lock);
+ rtc_lock(chip->rtc);

/* read status */
ret = regmap_read(regmap, AC100_ALM_INT_STA, &val);
@@ -551,7 +551,7 @@ static irqreturn_t ac100_rtc_irq(int irq, void *data)
}

out:
- mutex_unlock(&chip->rtc->ops_lock);
+ rtc_unlock(chip->rtc);
return IRQ_HANDLED;
}

--
2.29.2