Skip to content

Commit b685e6f

Browse files
linuswgregkh
authored andcommitted
tty: serial: ifx6x60: Use helper variable for dev
The &spi->dev is used so many times that the code gets visibly better by introducing a simple dev helper variable. Signed-off-by: Linus Walleij <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 2607d72 commit b685e6f

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

drivers/tty/serial/ifx6x60.c

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -992,22 +992,23 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
992992
int srdy;
993993
struct ifx_modem_platform_data *pl_data;
994994
struct ifx_spi_device *ifx_dev;
995+
struct device *dev = &spi->dev;
995996

996997
if (saved_ifx_dev) {
997-
dev_dbg(&spi->dev, "ignoring subsequent detection");
998+
dev_dbg(dev, "ignoring subsequent detection");
998999
return -ENODEV;
9991000
}
10001001

1001-
pl_data = dev_get_platdata(&spi->dev);
1002+
pl_data = dev_get_platdata(dev);
10021003
if (!pl_data) {
1003-
dev_err(&spi->dev, "missing platform data!");
1004+
dev_err(dev, "missing platform data!");
10041005
return -ENODEV;
10051006
}
10061007

10071008
/* initialize structure to hold our device variables */
10081009
ifx_dev = kzalloc(sizeof(struct ifx_spi_device), GFP_KERNEL);
10091010
if (!ifx_dev) {
1010-
dev_err(&spi->dev, "spi device allocation failed");
1011+
dev_err(dev, "spi device allocation failed");
10111012
return -ENOMEM;
10121013
}
10131014
saved_ifx_dev = ifx_dev;
@@ -1026,7 +1027,7 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
10261027
spi->bits_per_word = spi_bpw;
10271028
ret = spi_setup(spi);
10281029
if (ret) {
1029-
dev_err(&spi->dev, "SPI setup wasn't successful %d", ret);
1030+
dev_err(dev, "SPI setup wasn't successful %d", ret);
10301031
kfree(ifx_dev);
10311032
return -ENODEV;
10321033
}
@@ -1049,7 +1050,7 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
10491050
&ifx_dev->tx_bus,
10501051
GFP_KERNEL);
10511052
if (!ifx_dev->tx_buffer) {
1052-
dev_err(&spi->dev, "DMA-TX buffer allocation failed");
1053+
dev_err(dev, "DMA-TX buffer allocation failed");
10531054
ret = -ENOMEM;
10541055
goto error_ret;
10551056
}
@@ -1058,7 +1059,7 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
10581059
&ifx_dev->rx_bus,
10591060
GFP_KERNEL);
10601061
if (!ifx_dev->rx_buffer) {
1061-
dev_err(&spi->dev, "DMA-RX buffer allocation failed");
1062+
dev_err(dev, "DMA-RX buffer allocation failed");
10621063
ret = -ENOMEM;
10631064
goto error_ret;
10641065
}
@@ -1075,7 +1076,7 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
10751076
/* create our tty port */
10761077
ret = ifx_spi_create_port(ifx_dev);
10771078
if (ret != 0) {
1078-
dev_err(&spi->dev, "create default tty port failed");
1079+
dev_err(dev, "create default tty port failed");
10791080
goto error_ret;
10801081
}
10811082

@@ -1085,21 +1086,21 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
10851086
ifx_dev->gpio.srdy = pl_data->srdy;
10861087
ifx_dev->gpio.reset_out = pl_data->rst_out;
10871088

1088-
dev_info(&spi->dev, "gpios %d, %d, %d, %d, %d",
1089+
dev_info(dev, "gpios %d, %d, %d, %d, %d",
10891090
ifx_dev->gpio.reset, ifx_dev->gpio.po, ifx_dev->gpio.mrdy,
10901091
ifx_dev->gpio.srdy, ifx_dev->gpio.reset_out);
10911092

10921093
/* Configure gpios */
10931094
ret = gpio_request(ifx_dev->gpio.reset, "ifxModem");
10941095
if (ret < 0) {
1095-
dev_err(&spi->dev, "Unable to allocate GPIO%d (RESET)",
1096+
dev_err(dev, "Unable to allocate GPIO%d (RESET)",
10961097
ifx_dev->gpio.reset);
10971098
goto error_ret;
10981099
}
10991100
ret += gpio_direction_output(ifx_dev->gpio.reset, 0);
11001101
ret += gpio_export(ifx_dev->gpio.reset, 1);
11011102
if (ret) {
1102-
dev_err(&spi->dev, "Unable to configure GPIO%d (RESET)",
1103+
dev_err(dev, "Unable to configure GPIO%d (RESET)",
11031104
ifx_dev->gpio.reset);
11041105
ret = -EBUSY;
11051106
goto error_ret2;
@@ -1109,53 +1110,53 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
11091110
ret += gpio_direction_output(ifx_dev->gpio.po, 0);
11101111
ret += gpio_export(ifx_dev->gpio.po, 1);
11111112
if (ret) {
1112-
dev_err(&spi->dev, "Unable to configure GPIO%d (ON)",
1113+
dev_err(dev, "Unable to configure GPIO%d (ON)",
11131114
ifx_dev->gpio.po);
11141115
ret = -EBUSY;
11151116
goto error_ret3;
11161117
}
11171118

11181119
ret = gpio_request(ifx_dev->gpio.mrdy, "ifxModem");
11191120
if (ret < 0) {
1120-
dev_err(&spi->dev, "Unable to allocate GPIO%d (MRDY)",
1121+
dev_err(dev, "Unable to allocate GPIO%d (MRDY)",
11211122
ifx_dev->gpio.mrdy);
11221123
goto error_ret3;
11231124
}
11241125
ret += gpio_export(ifx_dev->gpio.mrdy, 1);
11251126
ret += gpio_direction_output(ifx_dev->gpio.mrdy, 0);
11261127
if (ret) {
1127-
dev_err(&spi->dev, "Unable to configure GPIO%d (MRDY)",
1128+
dev_err(dev, "Unable to configure GPIO%d (MRDY)",
11281129
ifx_dev->gpio.mrdy);
11291130
ret = -EBUSY;
11301131
goto error_ret4;
11311132
}
11321133

11331134
ret = gpio_request(ifx_dev->gpio.srdy, "ifxModem");
11341135
if (ret < 0) {
1135-
dev_err(&spi->dev, "Unable to allocate GPIO%d (SRDY)",
1136+
dev_err(dev, "Unable to allocate GPIO%d (SRDY)",
11361137
ifx_dev->gpio.srdy);
11371138
ret = -EBUSY;
11381139
goto error_ret4;
11391140
}
11401141
ret += gpio_export(ifx_dev->gpio.srdy, 1);
11411142
ret += gpio_direction_input(ifx_dev->gpio.srdy);
11421143
if (ret) {
1143-
dev_err(&spi->dev, "Unable to configure GPIO%d (SRDY)",
1144+
dev_err(dev, "Unable to configure GPIO%d (SRDY)",
11441145
ifx_dev->gpio.srdy);
11451146
ret = -EBUSY;
11461147
goto error_ret5;
11471148
}
11481149

11491150
ret = gpio_request(ifx_dev->gpio.reset_out, "ifxModem");
11501151
if (ret < 0) {
1151-
dev_err(&spi->dev, "Unable to allocate GPIO%d (RESET_OUT)",
1152+
dev_err(dev, "Unable to allocate GPIO%d (RESET_OUT)",
11521153
ifx_dev->gpio.reset_out);
11531154
goto error_ret5;
11541155
}
11551156
ret += gpio_export(ifx_dev->gpio.reset_out, 1);
11561157
ret += gpio_direction_input(ifx_dev->gpio.reset_out);
11571158
if (ret) {
1158-
dev_err(&spi->dev, "Unable to configure GPIO%d (RESET_OUT)",
1159+
dev_err(dev, "Unable to configure GPIO%d (RESET_OUT)",
11591160
ifx_dev->gpio.reset_out);
11601161
ret = -EBUSY;
11611162
goto error_ret6;
@@ -1166,7 +1167,7 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
11661167
IRQF_TRIGGER_RISING|IRQF_TRIGGER_FALLING, DRVNAME,
11671168
ifx_dev);
11681169
if (ret) {
1169-
dev_err(&spi->dev, "Unable to get irq %x\n",
1170+
dev_err(dev, "Unable to get irq %x\n",
11701171
gpio_to_irq(ifx_dev->gpio.reset_out));
11711172
goto error_ret6;
11721173
}
@@ -1177,14 +1178,14 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
11771178
ifx_spi_srdy_interrupt, IRQF_TRIGGER_RISING, DRVNAME,
11781179
ifx_dev);
11791180
if (ret) {
1180-
dev_err(&spi->dev, "Unable to get irq %x",
1181+
dev_err(dev, "Unable to get irq %x",
11811182
gpio_to_irq(ifx_dev->gpio.srdy));
11821183
goto error_ret7;
11831184
}
11841185

11851186
/* set pm runtime power state and register with power system */
1186-
pm_runtime_set_active(&spi->dev);
1187-
pm_runtime_enable(&spi->dev);
1187+
pm_runtime_set_active(dev);
1188+
pm_runtime_enable(dev);
11881189

11891190
/* handle case that modem is already signaling SRDY */
11901191
/* no outgoing tty open at this point, this just satisfies the

0 commit comments

Comments
 (0)