Skip to content

Commit a289a78

Browse files
hvilleneuvedoogregkh
authored andcommitted
serial: sc16is7xx: rename EFR mutex with generic name
[ Upstream commit d9b2d7d ] This mutex is used as a lock when accessing registers that share the same address space, not necessarily EFR registers. For example, address 0x06 is shared by MSR, TCR and XOFF1 registers, independently of EFR. Rename the mutex with a more generic name to avoid misinterpreting its usage. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Link: https://patch.msgid.link/20251027142957.1032073-3-hugo@hugovil.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Stable-dep-of: 246ac11 ("serial: sc16is7xx: enable THRI before filling TX FIFO") Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 7047aa3 commit a289a78

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

drivers/tty/serial/sc16is7xx.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ struct sc16is7xx_one_config {
330330
struct sc16is7xx_one {
331331
struct uart_port port;
332332
struct regmap *regmap;
333-
struct mutex efr_lock; /* EFR registers access */
333+
struct mutex lock; /* For registers sharing same address space. */
334334
struct kthread_work tx_work;
335335
struct kthread_work reg_work;
336336
struct kthread_delayed_work ms_work;
@@ -437,7 +437,7 @@ static void sc16is7xx_efr_lock(struct uart_port *port)
437437
{
438438
struct sc16is7xx_one *one = to_sc16is7xx_one(port, port);
439439

440-
mutex_lock(&one->efr_lock);
440+
mutex_lock(&one->lock);
441441

442442
/* Backup content of LCR. */
443443
one->old_lcr = sc16is7xx_port_read(port, SC16IS7XX_LCR_REG);
@@ -459,7 +459,7 @@ static void sc16is7xx_efr_unlock(struct uart_port *port)
459459
/* Restore original content of LCR */
460460
sc16is7xx_port_write(port, SC16IS7XX_LCR_REG, one->old_lcr);
461461

462-
mutex_unlock(&one->efr_lock);
462+
mutex_unlock(&one->lock);
463463
}
464464

465465
static void sc16is7xx_ier_clear(struct uart_port *port, u8 bit)
@@ -593,7 +593,7 @@ static int sc16is7xx_set_baud(struct uart_port *port, int baud)
593593
SC16IS7XX_MCR_CLKSEL_BIT,
594594
prescaler == 1 ? 0 : SC16IS7XX_MCR_CLKSEL_BIT);
595595

596-
mutex_lock(&one->efr_lock);
596+
mutex_lock(&one->lock);
597597

598598
/* Backup LCR and access special register set (DLL/DLH) */
599599
lcr = sc16is7xx_port_read(port, SC16IS7XX_LCR_REG);
@@ -609,7 +609,7 @@ static int sc16is7xx_set_baud(struct uart_port *port, int baud)
609609
/* Restore LCR and access to general register set */
610610
sc16is7xx_port_write(port, SC16IS7XX_LCR_REG, lcr);
611611

612-
mutex_unlock(&one->efr_lock);
612+
mutex_unlock(&one->lock);
613613

614614
return DIV_ROUND_CLOSEST((clk / prescaler) / 16, div);
615615
}
@@ -765,7 +765,7 @@ static void sc16is7xx_update_mlines(struct sc16is7xx_one *one)
765765
unsigned long flags;
766766
unsigned int status, changed;
767767

768-
lockdep_assert_held_once(&one->efr_lock);
768+
lockdep_assert_held_once(&one->lock);
769769

770770
status = sc16is7xx_get_hwmctrl(port);
771771
changed = status ^ one->old_mctrl;
@@ -796,7 +796,7 @@ static bool sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno)
796796
struct uart_port *port = &s->p[portno].port;
797797
struct sc16is7xx_one *one = to_sc16is7xx_one(port, port);
798798

799-
mutex_lock(&one->efr_lock);
799+
mutex_lock(&one->lock);
800800

801801
iir = sc16is7xx_port_read(port, SC16IS7XX_IIR_REG);
802802
if (iir & SC16IS7XX_IIR_NO_INT_BIT) {
@@ -843,7 +843,7 @@ static bool sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno)
843843
}
844844

845845
out_port_irq:
846-
mutex_unlock(&one->efr_lock);
846+
mutex_unlock(&one->lock);
847847

848848
return rc;
849849
}
@@ -875,9 +875,9 @@ static void sc16is7xx_tx_proc(struct kthread_work *ws)
875875
(port->rs485.delay_rts_before_send > 0))
876876
msleep(port->rs485.delay_rts_before_send);
877877

878-
mutex_lock(&one->efr_lock);
878+
mutex_lock(&one->lock);
879879
sc16is7xx_handle_tx(port);
880-
mutex_unlock(&one->efr_lock);
880+
mutex_unlock(&one->lock);
881881
}
882882

883883
static void sc16is7xx_reconf_rs485(struct uart_port *port)
@@ -944,9 +944,9 @@ static void sc16is7xx_ms_proc(struct kthread_work *ws)
944944
struct sc16is7xx_port *s = dev_get_drvdata(one->port.dev);
945945

946946
if (one->port.state) {
947-
mutex_lock(&one->efr_lock);
947+
mutex_lock(&one->lock);
948948
sc16is7xx_update_mlines(one);
949-
mutex_unlock(&one->efr_lock);
949+
mutex_unlock(&one->lock);
950950

951951
kthread_queue_delayed_work(&s->kworker, &one->ms_work, HZ);
952952
}
@@ -1587,7 +1587,7 @@ static int sc16is7xx_probe(struct device *dev,
15871587
s->p[i].old_mctrl = 0;
15881588
s->p[i].regmap = regmaps[i];
15891589

1590-
mutex_init(&s->p[i].efr_lock);
1590+
mutex_init(&s->p[i].lock);
15911591

15921592
ret = uart_get_rs485_mode(&s->p[i].port);
15931593
if (ret)

0 commit comments

Comments
 (0)