Skip to content

Commit 97a6cfe

Browse files
krzkgregkh
authored andcommitted
tty: serial: samsung: constify s3c24xx_serial_drv_data
The driver data (struct s3c24xx_serial_drv_data) is only used to initialize the driver properly and is not modified. Make it const. Tested-by: Alim Akhtar <alim.akhtar@samsung.com> Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> Link: https://lore.kernel.org/r/20220308080919.152715-5-krzysztof.kozlowski@canonical.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3aec400 commit 97a6cfe

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

drivers/tty/serial/samsung_tty.c

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,14 @@ struct s3c24xx_uart_port {
136136
unsigned int tx_mode;
137137
unsigned int rx_mode;
138138

139-
struct s3c24xx_uart_info *info;
139+
const struct s3c24xx_uart_info *info;
140140
struct clk *clk;
141141
struct clk *baudclk;
142142
struct uart_port port;
143-
struct s3c24xx_serial_drv_data *drv_data;
143+
const struct s3c24xx_serial_drv_data *drv_data;
144144

145145
/* reference to platform data */
146-
struct s3c2410_uartcfg *cfg;
146+
const struct s3c2410_uartcfg *cfg;
147147

148148
struct s3c24xx_uart_dma *dma;
149149

@@ -221,7 +221,7 @@ static inline void s3c24xx_clear_bit(struct uart_port *port, int idx,
221221
local_irq_restore(flags);
222222
}
223223

224-
static inline struct s3c24xx_uart_port *to_ourport(struct uart_port *port)
224+
static inline struct s3c24xx_uart_port *to_ourport(const struct uart_port *port)
225225
{
226226
return container_of(port, struct s3c24xx_uart_port, port);
227227
}
@@ -573,13 +573,13 @@ static void s3c24xx_serial_stop_rx(struct uart_port *port)
573573
}
574574
}
575575

576-
static inline struct s3c24xx_uart_info
576+
static inline const struct s3c24xx_uart_info
577577
*s3c24xx_port_to_info(struct uart_port *port)
578578
{
579579
return to_ourport(port)->info;
580580
}
581581

582-
static inline struct s3c2410_uartcfg
582+
static inline const struct s3c2410_uartcfg
583583
*s3c24xx_port_to_cfg(struct uart_port *port)
584584
{
585585
struct s3c24xx_uart_port *ourport;
@@ -594,7 +594,7 @@ static inline struct s3c2410_uartcfg
594594
static int s3c24xx_serial_rx_fifocnt(struct s3c24xx_uart_port *ourport,
595595
unsigned long ufstat)
596596
{
597-
struct s3c24xx_uart_info *info = ourport->info;
597+
const struct s3c24xx_uart_info *info = ourport->info;
598598

599599
if (ufstat & info->rx_fifofull)
600600
return ourport->port.fifosize;
@@ -983,7 +983,7 @@ static irqreturn_t apple_serial_handle_irq(int irq, void *id)
983983

984984
static unsigned int s3c24xx_serial_tx_empty(struct uart_port *port)
985985
{
986-
struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
986+
const struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
987987
unsigned long ufstat = rd_regl(port, S3C2410_UFSTAT);
988988
unsigned long ufcon = rd_regl(port, S3C2410_UFCON);
989989

@@ -1402,7 +1402,7 @@ static void s3c24xx_serial_pm(struct uart_port *port, unsigned int level,
14021402

14031403
static inline int s3c24xx_serial_getsource(struct uart_port *port)
14041404
{
1405-
struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
1405+
const struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
14061406
unsigned int ucon;
14071407

14081408
if (info->num_clks == 1)
@@ -1416,7 +1416,7 @@ static inline int s3c24xx_serial_getsource(struct uart_port *port)
14161416
static void s3c24xx_serial_setsource(struct uart_port *port,
14171417
unsigned int clk_sel)
14181418
{
1419-
struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
1419+
const struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
14201420
unsigned int ucon;
14211421

14221422
if (info->num_clks == 1)
@@ -1435,7 +1435,7 @@ static unsigned int s3c24xx_serial_getclk(struct s3c24xx_uart_port *ourport,
14351435
unsigned int req_baud, struct clk **best_clk,
14361436
unsigned int *clk_num)
14371437
{
1438-
struct s3c24xx_uart_info *info = ourport->info;
1438+
const struct s3c24xx_uart_info *info = ourport->info;
14391439
struct clk *clk;
14401440
unsigned long rate;
14411441
unsigned int cnt, baud, quot, best_quot = 0;
@@ -1519,7 +1519,7 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
15191519
struct ktermios *termios,
15201520
struct ktermios *old)
15211521
{
1522-
struct s3c2410_uartcfg *cfg = s3c24xx_port_to_cfg(port);
1522+
const struct s3c2410_uartcfg *cfg = s3c24xx_port_to_cfg(port);
15231523
struct s3c24xx_uart_port *ourport = to_ourport(port);
15241524
struct clk *clk = ERR_PTR(-EINVAL);
15251525
unsigned long flags;
@@ -1688,7 +1688,7 @@ static const char *s3c24xx_serial_type(struct uart_port *port)
16881688

16891689
static void s3c24xx_serial_config_port(struct uart_port *port, int flags)
16901690
{
1691-
struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
1691+
const struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
16921692

16931693
if (flags & UART_CONFIG_TYPE)
16941694
port->type = info->port_type;
@@ -1700,7 +1700,7 @@ static void s3c24xx_serial_config_port(struct uart_port *port, int flags)
17001700
static int
17011701
s3c24xx_serial_verify_port(struct uart_port *port, struct serial_struct *ser)
17021702
{
1703-
struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
1703+
const struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
17041704

17051705
if (ser->type != PORT_UNKNOWN && ser->type != info->port_type)
17061706
return -EINVAL;
@@ -1870,9 +1870,9 @@ s3c24xx_serial_ports[CONFIG_SERIAL_SAMSUNG_UARTS] = {
18701870
*/
18711871

18721872
static void s3c24xx_serial_resetport(struct uart_port *port,
1873-
struct s3c2410_uartcfg *cfg)
1873+
const struct s3c2410_uartcfg *cfg)
18741874
{
1875-
struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
1875+
const struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
18761876
unsigned long ucon = rd_regl(port, S3C2410_UCON);
18771877

18781878
ucon &= (info->clksel_mask | info->ucon_mask);
@@ -1976,7 +1976,7 @@ s3c24xx_serial_cpufreq_deregister(struct s3c24xx_uart_port *port)
19761976
static int s3c24xx_serial_enable_baudclk(struct s3c24xx_uart_port *ourport)
19771977
{
19781978
struct device *dev = ourport->port.dev;
1979-
struct s3c24xx_uart_info *info = ourport->info;
1979+
const struct s3c24xx_uart_info *info = ourport->info;
19801980
char clk_name[MAX_CLK_NAME_LENGTH];
19811981
unsigned int clk_sel;
19821982
struct clk *clk;
@@ -2018,7 +2018,7 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
20182018
struct platform_device *platdev)
20192019
{
20202020
struct uart_port *port = &ourport->port;
2021-
struct s3c2410_uartcfg *cfg = ourport->cfg;
2021+
const struct s3c2410_uartcfg *cfg = ourport->cfg;
20222022
struct resource *res;
20232023
int ret;
20242024

@@ -2153,7 +2153,7 @@ static const struct of_device_id s3c24xx_uart_dt_match[];
21532153

21542154
static int probe_index;
21552155

2156-
static inline struct s3c24xx_serial_drv_data *
2156+
static inline const struct s3c24xx_serial_drv_data *
21572157
s3c24xx_get_driver_data(struct platform_device *pdev)
21582158
{
21592159
#ifdef CONFIG_OF
@@ -2416,7 +2416,7 @@ static struct uart_port *cons_uart;
24162416
static int
24172417
s3c24xx_serial_console_txrdy(struct uart_port *port, unsigned int ufcon)
24182418
{
2419-
struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
2419+
const struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
24202420
unsigned long ufstat, utrstat;
24212421

24222422
if (ufcon & S3C2410_UFCON_FIFOMODE) {
@@ -2612,7 +2612,7 @@ static struct console s3c24xx_serial_console = {
26122612
#endif /* CONFIG_SERIAL_SAMSUNG_CONSOLE */
26132613

26142614
#ifdef CONFIG_CPU_S3C2410
2615-
static struct s3c24xx_serial_drv_data s3c2410_serial_drv_data = {
2615+
static const struct s3c24xx_serial_drv_data s3c2410_serial_drv_data = {
26162616
.info = {
26172617
.name = "Samsung S3C2410 UART",
26182618
.type = TYPE_S3C24XX,
@@ -2640,7 +2640,7 @@ static struct s3c24xx_serial_drv_data s3c2410_serial_drv_data = {
26402640
#endif
26412641

26422642
#ifdef CONFIG_CPU_S3C2412
2643-
static struct s3c24xx_serial_drv_data s3c2412_serial_drv_data = {
2643+
static const struct s3c24xx_serial_drv_data s3c2412_serial_drv_data = {
26442644
.info = {
26452645
.name = "Samsung S3C2412 UART",
26462646
.type = TYPE_S3C24XX,
@@ -2670,7 +2670,7 @@ static struct s3c24xx_serial_drv_data s3c2412_serial_drv_data = {
26702670

26712671
#if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2416) || \
26722672
defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2442)
2673-
static struct s3c24xx_serial_drv_data s3c2440_serial_drv_data = {
2673+
static const struct s3c24xx_serial_drv_data s3c2440_serial_drv_data = {
26742674
.info = {
26752675
.name = "Samsung S3C2440 UART",
26762676
.type = TYPE_S3C24XX,
@@ -2700,7 +2700,7 @@ static struct s3c24xx_serial_drv_data s3c2440_serial_drv_data = {
27002700
#endif
27012701

27022702
#if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410)
2703-
static struct s3c24xx_serial_drv_data s3c6400_serial_drv_data = {
2703+
static const struct s3c24xx_serial_drv_data s3c6400_serial_drv_data = {
27042704
.info = {
27052705
.name = "Samsung S3C6400 UART",
27062706
.type = TYPE_S3C6400,
@@ -2729,7 +2729,7 @@ static struct s3c24xx_serial_drv_data s3c6400_serial_drv_data = {
27292729
#endif
27302730

27312731
#ifdef CONFIG_CPU_S5PV210
2732-
static struct s3c24xx_serial_drv_data s5pv210_serial_drv_data = {
2732+
static const struct s3c24xx_serial_drv_data s5pv210_serial_drv_data = {
27332733
.info = {
27342734
.name = "Samsung S5PV210 UART",
27352735
.type = TYPE_S3C6400,
@@ -2781,17 +2781,17 @@ static struct s3c24xx_serial_drv_data s5pv210_serial_drv_data = {
27812781
.has_fracval = 1, \
27822782
} \
27832783

2784-
static struct s3c24xx_serial_drv_data exynos4210_serial_drv_data = {
2784+
static const struct s3c24xx_serial_drv_data exynos4210_serial_drv_data = {
27852785
EXYNOS_COMMON_SERIAL_DRV_DATA(),
27862786
.fifosize = { 256, 64, 16, 16 },
27872787
};
27882788

2789-
static struct s3c24xx_serial_drv_data exynos5433_serial_drv_data = {
2789+
static const struct s3c24xx_serial_drv_data exynos5433_serial_drv_data = {
27902790
EXYNOS_COMMON_SERIAL_DRV_DATA(),
27912791
.fifosize = { 64, 256, 16, 256 },
27922792
};
27932793

2794-
static struct s3c24xx_serial_drv_data exynos850_serial_drv_data = {
2794+
static const struct s3c24xx_serial_drv_data exynos850_serial_drv_data = {
27952795
EXYNOS_COMMON_SERIAL_DRV_DATA(),
27962796
.fifosize = { 256, 64, 64, 64 },
27972797
};
@@ -2807,7 +2807,7 @@ static struct s3c24xx_serial_drv_data exynos850_serial_drv_data = {
28072807
#endif
28082808

28092809
#ifdef CONFIG_ARCH_APPLE
2810-
static struct s3c24xx_serial_drv_data s5l_serial_drv_data = {
2810+
static const struct s3c24xx_serial_drv_data s5l_serial_drv_data = {
28112811
.info = {
28122812
.name = "Apple S5L UART",
28132813
.type = TYPE_APPLE_S5L,

0 commit comments

Comments
 (0)