Skip to content

Commit

Permalink
Merge branch 'pci200syn-cleanups'
Browse files Browse the repository at this point in the history
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 <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Jun 15, 2021
2 parents 5938b22 + 6855d30 commit ad5645d
Showing 1 changed file with 15 additions and 36 deletions.
51 changes: 15 additions & 36 deletions drivers/net/wan/pci200syn.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
static int pci_clock_freq = 33000000;
#define CLOCK_BASE pci_clock_freq

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


} plx9052;

typedef struct port_s {
struct napi_struct napi;
Expand All @@ -74,9 +71,7 @@ typedef struct port_s {
u16 txlast;
u8 rxs, txs, tmc; /* SCA registers */
u8 chan; /* physical port # - 0 or 1 */
}port_t;


} port_t;

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

port_t ports[2];
}card_t;

} card_t;

#define get_port(card, port) (&card->ports[port])
#define get_port(card, port) (&(card)->ports[port])
#define sca_flush(card) (sca_in(IER0, card))

static inline void new_memcpy_toio(char __iomem *dest, char *src, int length)
{
int len;

do {
len = length > 256 ? 256 : length;
memcpy_toio(dest, src, len);
Expand All @@ -112,7 +107,6 @@ static inline void new_memcpy_toio(char __iomem *dest, char *src, int length)

#include "hd64572.c"


static void pci200_set_iface(port_t *port)
{
card_t *card = port->card;
Expand All @@ -122,7 +116,7 @@ static void pci200_set_iface(port_t *port)

sca_out(EXS_TES1, (port->chan ? MSCI1_OFFSET : MSCI0_OFFSET) + EXS,
port->card);
switch(port->settings.clock_type) {
switch (port->settings.clock_type) {
case CLOCK_INT:
rxs |= CLK_BRG; /* BRG output */
txs |= CLK_PIN_OUT | CLK_TX_RXCLK; /* RX clock */
Expand Down Expand Up @@ -151,13 +145,11 @@ static void pci200_set_iface(port_t *port)
sca_set_port(port);
}



static int pci200_open(struct net_device *dev)
{
port_t *port = dev_to_port(dev);

int result = hdlc_open(dev);

if (result)
return result;

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



static int pci200_close(struct net_device *dev)
{
sca_close(dev);
Expand All @@ -177,8 +167,6 @@ static int pci200_close(struct net_device *dev)
return 0;
}



static int pci200_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
const size_t size = sizeof(sync_serial_settings);
Expand All @@ -195,7 +183,7 @@ static int pci200_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
if (cmd != SIOCWANDEV)
return hdlc_ioctl(dev, ifr, cmd);

switch(ifr->ifr_settings.type) {
switch (ifr->ifr_settings.type) {
case IF_GET_IFACE:
ifr->ifr_settings.type = IF_IFACE_V35;
if (ifr->ifr_settings.size < size) {
Expand Down Expand Up @@ -233,8 +221,6 @@ static int pci200_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
}
}



static void pci200_pci_remove_one(struct pci_dev *pdev)
{
int i;
Expand Down Expand Up @@ -292,7 +278,7 @@ static int pci200_pci_init_one(struct pci_dev *pdev,
}

card = kzalloc(sizeof(card_t), GFP_KERNEL);
if (card == NULL) {
if (!card) {
pci_release_regions(pdev);
pci_disable_device(pdev);
return -ENOBUFS;
Expand All @@ -314,18 +300,16 @@ static int pci200_pci_init_one(struct pci_dev *pdev,
return -EFAULT;
}

plxphys = pci_resource_start(pdev,0) & PCI_BASE_ADDRESS_MEM_MASK;
plxphys = pci_resource_start(pdev, 0) & PCI_BASE_ADDRESS_MEM_MASK;
card->plxbase = ioremap(plxphys, PCI200SYN_PLX_SIZE);

scaphys = pci_resource_start(pdev,2) & PCI_BASE_ADDRESS_MEM_MASK;
scaphys = pci_resource_start(pdev, 2) & PCI_BASE_ADDRESS_MEM_MASK;
card->scabase = ioremap(scaphys, PCI200SYN_SCA_SIZE);

ramphys = pci_resource_start(pdev,3) & PCI_BASE_ADDRESS_MEM_MASK;
ramphys = pci_resource_start(pdev, 3) & PCI_BASE_ADDRESS_MEM_MASK;
card->rambase = pci_ioremap_bar(pdev, 3);

if (card->plxbase == NULL ||
card->scabase == NULL ||
card->rambase == NULL) {
if (!card->plxbase || !card->scabase || !card->rambase) {
pr_err("ioremap() failed\n");
pci200_pci_remove_one(pdev);
return -EFAULT;
Expand Down Expand Up @@ -380,6 +364,7 @@ static int pci200_pci_init_one(struct pci_dev *pdev,
port_t *port = &card->ports[i];
struct net_device *dev = port->netdev;
hdlc_device *hdlc = dev_to_hdlc(dev);

port->chan = i;

spin_lock_init(&port->lock);
Expand Down Expand Up @@ -407,23 +392,19 @@ static int pci200_pci_init_one(struct pci_dev *pdev,
return 0;
}



static const struct pci_device_id pci200_pci_tbl[] = {
{ PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, PCI_VENDOR_ID_PLX,
PCI_DEVICE_ID_PLX_PCI200SYN, 0, 0, 0 },
{ 0, }
};


static struct pci_driver pci200_pci_driver = {
.name = "PCI200SYN",
.id_table = pci200_pci_tbl,
.probe = pci200_pci_init_one,
.remove = pci200_pci_remove_one,
};


static int __init pci200_init_module(void)
{
if (pci_clock_freq < 1000000 || pci_clock_freq > 80000000) {
Expand All @@ -433,8 +414,6 @@ static int __init pci200_init_module(void)
return pci_register_driver(&pci200_pci_driver);
}



static void __exit pci200_cleanup_module(void)
{
pci_unregister_driver(&pci200_pci_driver);
Expand Down

0 comments on commit ad5645d

Please sign in to comment.