Skip to content

Commit ad5645d

Browse files
committed
Merge branch 'pci200syn-cleanups'
Peng Li says: ==================== net: pci200syn: clean up some code style issues This patchset clean up some code style issues. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 5938b22 + 6855d30 commit ad5645d

File tree

1 file changed

+15
-36
lines changed

1 file changed

+15
-36
lines changed

drivers/net/wan/pci200syn.c

Lines changed: 15 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@
4242
static int pci_clock_freq = 33000000;
4343
#define CLOCK_BASE pci_clock_freq
4444

45-
/*
46-
* PLX PCI9052 local configuration and shared runtime registers.
45+
/* PLX PCI9052 local configuration and shared runtime registers.
4746
* This structure can be used to access 9052 registers (memory mapped).
4847
*/
4948
typedef struct {
@@ -56,9 +55,7 @@ typedef struct {
5655
u32 cs_base[4]; /* 3C-48h : Chip Select Base Addrs */
5756
u32 intr_ctrl_stat; /* 4Ch : Interrupt Control/Status */
5857
u32 init_ctrl; /* 50h : EEPROM ctrl, Init Ctrl, etc */
59-
}plx9052;
60-
61-
58+
} plx9052;
6259

6360
typedef struct port_s {
6461
struct napi_struct napi;
@@ -74,9 +71,7 @@ typedef struct port_s {
7471
u16 txlast;
7572
u8 rxs, txs, tmc; /* SCA registers */
7673
u8 chan; /* physical port # - 0 or 1 */
77-
}port_t;
78-
79-
74+
} port_t;
8075

8176
typedef struct card_s {
8277
u8 __iomem *rambase; /* buffer memory base (virtual) */
@@ -88,15 +83,15 @@ typedef struct card_s {
8883
u8 irq; /* interrupt request level */
8984

9085
port_t ports[2];
91-
}card_t;
92-
86+
} card_t;
9387

94-
#define get_port(card, port) (&card->ports[port])
88+
#define get_port(card, port) (&(card)->ports[port])
9589
#define sca_flush(card) (sca_in(IER0, card))
9690

9791
static inline void new_memcpy_toio(char __iomem *dest, char *src, int length)
9892
{
9993
int len;
94+
10095
do {
10196
len = length > 256 ? 256 : length;
10297
memcpy_toio(dest, src, len);
@@ -112,7 +107,6 @@ static inline void new_memcpy_toio(char __iomem *dest, char *src, int length)
112107

113108
#include "hd64572.c"
114109

115-
116110
static void pci200_set_iface(port_t *port)
117111
{
118112
card_t *card = port->card;
@@ -122,7 +116,7 @@ static void pci200_set_iface(port_t *port)
122116

123117
sca_out(EXS_TES1, (port->chan ? MSCI1_OFFSET : MSCI0_OFFSET) + EXS,
124118
port->card);
125-
switch(port->settings.clock_type) {
119+
switch (port->settings.clock_type) {
126120
case CLOCK_INT:
127121
rxs |= CLK_BRG; /* BRG output */
128122
txs |= CLK_PIN_OUT | CLK_TX_RXCLK; /* RX clock */
@@ -151,13 +145,11 @@ static void pci200_set_iface(port_t *port)
151145
sca_set_port(port);
152146
}
153147

154-
155-
156148
static int pci200_open(struct net_device *dev)
157149
{
158150
port_t *port = dev_to_port(dev);
159-
160151
int result = hdlc_open(dev);
152+
161153
if (result)
162154
return result;
163155

@@ -167,8 +159,6 @@ static int pci200_open(struct net_device *dev)
167159
return 0;
168160
}
169161

170-
171-
172162
static int pci200_close(struct net_device *dev)
173163
{
174164
sca_close(dev);
@@ -177,8 +167,6 @@ static int pci200_close(struct net_device *dev)
177167
return 0;
178168
}
179169

180-
181-
182170
static int pci200_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
183171
{
184172
const size_t size = sizeof(sync_serial_settings);
@@ -195,7 +183,7 @@ static int pci200_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
195183
if (cmd != SIOCWANDEV)
196184
return hdlc_ioctl(dev, ifr, cmd);
197185

198-
switch(ifr->ifr_settings.type) {
186+
switch (ifr->ifr_settings.type) {
199187
case IF_GET_IFACE:
200188
ifr->ifr_settings.type = IF_IFACE_V35;
201189
if (ifr->ifr_settings.size < size) {
@@ -233,8 +221,6 @@ static int pci200_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
233221
}
234222
}
235223

236-
237-
238224
static void pci200_pci_remove_one(struct pci_dev *pdev)
239225
{
240226
int i;
@@ -292,7 +278,7 @@ static int pci200_pci_init_one(struct pci_dev *pdev,
292278
}
293279

294280
card = kzalloc(sizeof(card_t), GFP_KERNEL);
295-
if (card == NULL) {
281+
if (!card) {
296282
pci_release_regions(pdev);
297283
pci_disable_device(pdev);
298284
return -ENOBUFS;
@@ -314,18 +300,16 @@ static int pci200_pci_init_one(struct pci_dev *pdev,
314300
return -EFAULT;
315301
}
316302

317-
plxphys = pci_resource_start(pdev,0) & PCI_BASE_ADDRESS_MEM_MASK;
303+
plxphys = pci_resource_start(pdev, 0) & PCI_BASE_ADDRESS_MEM_MASK;
318304
card->plxbase = ioremap(plxphys, PCI200SYN_PLX_SIZE);
319305

320-
scaphys = pci_resource_start(pdev,2) & PCI_BASE_ADDRESS_MEM_MASK;
306+
scaphys = pci_resource_start(pdev, 2) & PCI_BASE_ADDRESS_MEM_MASK;
321307
card->scabase = ioremap(scaphys, PCI200SYN_SCA_SIZE);
322308

323-
ramphys = pci_resource_start(pdev,3) & PCI_BASE_ADDRESS_MEM_MASK;
309+
ramphys = pci_resource_start(pdev, 3) & PCI_BASE_ADDRESS_MEM_MASK;
324310
card->rambase = pci_ioremap_bar(pdev, 3);
325311

326-
if (card->plxbase == NULL ||
327-
card->scabase == NULL ||
328-
card->rambase == NULL) {
312+
if (!card->plxbase || !card->scabase || !card->rambase) {
329313
pr_err("ioremap() failed\n");
330314
pci200_pci_remove_one(pdev);
331315
return -EFAULT;
@@ -380,6 +364,7 @@ static int pci200_pci_init_one(struct pci_dev *pdev,
380364
port_t *port = &card->ports[i];
381365
struct net_device *dev = port->netdev;
382366
hdlc_device *hdlc = dev_to_hdlc(dev);
367+
383368
port->chan = i;
384369

385370
spin_lock_init(&port->lock);
@@ -407,23 +392,19 @@ static int pci200_pci_init_one(struct pci_dev *pdev,
407392
return 0;
408393
}
409394

410-
411-
412395
static const struct pci_device_id pci200_pci_tbl[] = {
413396
{ PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, PCI_VENDOR_ID_PLX,
414397
PCI_DEVICE_ID_PLX_PCI200SYN, 0, 0, 0 },
415398
{ 0, }
416399
};
417400

418-
419401
static struct pci_driver pci200_pci_driver = {
420402
.name = "PCI200SYN",
421403
.id_table = pci200_pci_tbl,
422404
.probe = pci200_pci_init_one,
423405
.remove = pci200_pci_remove_one,
424406
};
425407

426-
427408
static int __init pci200_init_module(void)
428409
{
429410
if (pci_clock_freq < 1000000 || pci_clock_freq > 80000000) {
@@ -433,8 +414,6 @@ static int __init pci200_init_module(void)
433414
return pci_register_driver(&pci200_pci_driver);
434415
}
435416

436-
437-
438417
static void __exit pci200_cleanup_module(void)
439418
{
440419
pci_unregister_driver(&pci200_pci_driver);

0 commit comments

Comments
 (0)