aboutsummaryrefslogtreecommitdiffstats
path: root/package/switch
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2010-07-20 22:25:04 +0000
committerFlorian Fainelli <florian@openwrt.org>2010-07-20 22:25:04 +0000
commitb2ef939d7494a44f51dd982a41e36595476bf561 (patch)
tree8cac64d84264e9be5a18fb9a31ce6593d0519ce4 /package/switch
parent7e525aa71e6b93adf50d6fbf0a6c54f158f9b666 (diff)
downloadupstream-b2ef939d7494a44f51dd982a41e36595476bf561.tar.gz
upstream-b2ef939d7494a44f51dd982a41e36595476bf561.tar.bz2
upstream-b2ef939d7494a44f51dd982a41e36595476bf561.zip
[package] remove whitespaces in kmod-switch sources
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@22320 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/switch')
-rw-r--r--package/switch/src/switch-adm.c36
-rw-r--r--package/switch/src/switch-core.c38
-rw-r--r--package/switch/src/switch-robo.c38
3 files changed, 56 insertions, 56 deletions
diff --git a/package/switch/src/switch-adm.c b/package/switch/src/switch-adm.c
index 89efed1e82..fa59c3fb8d 100644
--- a/package/switch/src/switch-adm.c
+++ b/package/switch/src/switch-adm.c
@@ -2,7 +2,7 @@
* ADMTEK Adm6996 switch configuration module
*
* Copyright (C) 2005 Felix Fietkau <nbd@nbd.name>
- *
+ *
* Partially based on Broadcom Home Networking Division 10/100 Mbit/s
* Ethernet Device Driver (from Montavista 2.4.20_mvl31 Kernel).
* Copyright (C) 2004 Broadcom Corporation
@@ -22,7 +22,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
@@ -182,10 +182,10 @@ static void adm_read(int cs, char *buf, unsigned int bits)
/* Enable outputs with specified value to the chip */
static void adm_enout(__u8 pins, __u8 val)
-{
+{
/* Prepare GPIO output value */
gpio_out(pins, val);
-
+
/* Enable GPIO outputs */
gpio_outen(pins, pins);
udelay(EECK_EDGE_TIME);
@@ -194,7 +194,7 @@ static void adm_enout(__u8 pins, __u8 val)
/* Disable outputs to the chip */
static void adm_disout(__u8 pins)
-{
+{
/* Disable GPIO outputs */
gpio_outen(pins, 0);
udelay(EECK_EDGE_TIME);
@@ -285,17 +285,17 @@ static int vlan_ports[] = { 1 << 0, 1 << 2, 1 << 4, 1 << 6, 1 << 7, 1 << 8 };
static int handle_vlan_port_read(void *driver, char *buf, int nr)
{
int ports, i, c, len = 0;
-
+
if ((nr < 0) || (nr > 15))
return 0;
/* Get VLAN port map */
ports = adm_rreg(0, 0x13 + nr);
-
+
for (i = 0; i <= 5; i++) {
if (ports & vlan_ports[i]) {
c = adm_rreg(0, port_conf[i]);
-
+
len += sprintf(buf + len, "%d", i);
if (c & (1 << 4)) {
buf[len++] = 't';
@@ -327,17 +327,17 @@ static int handle_vlan_port_write(void *driver, char *buf, int nr)
ports |= vlan_ports[i];
cfg = adm_rreg(0, port_conf[i]);
-
+
/* Tagging */
if (c->untag & (1 << i))
cfg &= ~(1 << 4);
else
cfg |= (1 << 4);
-
+
if ((c->untag | c->pvid) & (1 << i)) {
cfg = (cfg & ~(0xf << 10)) | (nr << 10);
}
-
+
adm_wreg(port_conf[i], (__u16) cfg);
} else {
ports &= ~(vlan_ports[i]);
@@ -356,7 +356,7 @@ static int handle_port_enable_read(void *driver, char *buf, int nr)
static int handle_port_enable_write(void *driver, char *buf, int nr)
{
int reg = adm_rreg(0, port_conf[nr]);
-
+
if (buf[0] == '0')
reg |= (1 << 5);
else if (buf[0] == '1')
@@ -391,7 +391,7 @@ static int handle_port_media_write(void *driver, char *buf, int nr)
if (media < 0)
return -1;
-
+
reg &= ~((1 << 1) | (1 << 2) | (1 << 3));
if (media & SWITCH_MEDIA_AUTO)
reg |= 1 << 1;
@@ -401,7 +401,7 @@ static int handle_port_media_write(void *driver, char *buf, int nr)
reg |= 1 << 3;
adm_wreg(port_conf[nr], reg);
-
+
return 0;
}
@@ -413,7 +413,7 @@ static int handle_vlan_enable_read(void *driver, char *buf, int nr)
static int handle_vlan_enable_write(void *driver, char *buf, int nr)
{
int reg = adm_rreg(0, 0x11);
-
+
if (buf[0] == '1')
reg |= (1 << 5);
else if (buf[0] == '0')
@@ -453,7 +453,7 @@ static int handle_reset(void *driver, char *buf, int nr)
udelay(1000);
/* Leave RC high and disable GPIO outputs */
adm_disout((__u8)(eecs | eesk | eedi));
-
+
}
/* set up initial configuration for cpu port */
@@ -462,7 +462,7 @@ static int handle_reset(void *driver, char *buf, int nr)
(1 << 4) | /* Tagging */
0xf); /* full duplex, 100Mbps, auto neg, flow ctrl */
adm_wreg(port_conf[5], cfg);
-
+
/* vlan mode select register (0x11): vlan on, mac clone */
adm_wreg(0x11, 0xff30);
@@ -472,7 +472,7 @@ static int handle_reset(void *driver, char *buf, int nr)
static int handle_registers(void *driver, char *buf, int nr)
{
int i, len = 0;
-
+
for (i = 0; i <= 0x33; i++) {
len += sprintf(buf + len, "0x%02x: 0x%04x\n", i, adm_rreg(0, i));
}
diff --git a/package/switch/src/switch-core.c b/package/switch/src/switch-core.c
index e4a3b10ad5..2e5395950e 100644
--- a/package/switch/src/switch-core.c
+++ b/package/switch/src/switch-core.c
@@ -71,10 +71,10 @@ static ssize_t switch_proc_read(struct file *file, char *buf, size_t count, loff
struct proc_dir_entry *dent = PDE(file->f_dentry->d_inode);
char *page;
int len = 0;
-
+
if ((page = kmalloc(SWITCH_MAX_BUFSZ, GFP_KERNEL)) == NULL)
return -ENOBUFS;
-
+
if (dent->data != NULL) {
switch_proc_handler *handler = (switch_proc_handler *) dent->data;
if (handler->handler.read != NULL)
@@ -112,7 +112,7 @@ static ssize_t switch_proc_write(struct file *file, const char *buf, size_t coun
return -EINVAL;
}
page[count] = 0;
-
+
if (dent->data != NULL) {
switch_proc_handler *handler = (switch_proc_handler *) dent->data;
if (handler->handler.write != NULL) {
@@ -154,11 +154,11 @@ static void add_handler(switch_driver *driver, const switch_config *handler, str
tmp->driver = driver;
memcpy(&tmp->handler, handler, sizeof(switch_config));
list_add(&tmp->list, &priv->data.list);
-
+
mode = 0;
if (handler->read != NULL) mode |= S_IRUSR;
if (handler->write != NULL) mode |= S_IWUSR;
-
+
if ((p = create_proc_entry(handler->name, mode, parent)) != NULL) {
p->data = (void *) tmp;
p->proc_fops = &switch_proc_fops;
@@ -168,11 +168,11 @@ static void add_handler(switch_driver *driver, const switch_config *handler, str
static inline void add_handlers(switch_driver *driver, const switch_config *handlers, struct proc_dir_entry *parent, int nr)
{
int i;
-
+
for (i = 0; handlers[i].name != NULL; i++) {
add_handler(driver, &(handlers[i]), parent, nr);
}
-}
+}
static void remove_handlers(switch_priv *priv)
{
@@ -195,7 +195,7 @@ static void do_unregister(switch_driver *driver)
switch_priv *priv = (switch_priv *) driver->data;
remove_handlers(priv);
-
+
for(i = 0; priv->ports[i] != NULL; i++) {
sprintf(buf, "%d", i);
remove_proc_entry(buf, priv->port_dir);
@@ -211,7 +211,7 @@ static void do_unregister(switch_driver *driver)
remove_proc_entry("vlan", priv->driver_dir);
remove_proc_entry(driver->interface, switch_root);
-
+
if (priv->nr == (drv_num - 1))
drv_num--;
@@ -250,14 +250,14 @@ static int do_register(switch_driver *driver)
}
INIT_LIST_HEAD(&priv->data.list);
-
+
priv->nr = drv_num++;
priv->driver_dir = proc_mkdir(driver->interface, switch_root);
if (driver->driver_handlers != NULL) {
add_handlers(driver, driver->driver_handlers, priv->driver_dir, 0);
add_handlers(driver, global_driver_handlers, priv->driver_dir, 0);
}
-
+
priv->port_dir = proc_mkdir("port", priv->driver_dir);
for (i = 0; i < driver->ports; i++) {
sprintf(buf, "%d", i);
@@ -266,7 +266,7 @@ static int do_register(switch_driver *driver)
add_handlers(driver, driver->port_handlers, priv->ports[i], i);
}
priv->ports[i] = NULL;
-
+
priv->vlan_dir = proc_mkdir("vlan", priv->driver_dir);
for (i = 0; i < driver->vlans; i++) {
sprintf(buf, "%d", i);
@@ -275,7 +275,7 @@ static int do_register(switch_driver *driver)
add_handlers(driver, driver->vlan_handlers, priv->vlans[i], i);
}
priv->vlans[i] = NULL;
-
+
return 0;
}
@@ -294,7 +294,7 @@ static inline int isspace(char c) {
#define toupper(c) (islower(c) ? ((c) ^ 0x20) : (c))
#define islower(c) (((unsigned char)((c) - 'a')) < 26)
-
+
int switch_parse_media(char *buf)
{
char *str = buf;
@@ -340,7 +340,7 @@ switch_vlan_config *switch_parse_vlan(switch_driver *driver, char *buf)
{
switch_vlan_config *c;
int j, u, p, s;
-
+
c = kmalloc(sizeof(switch_vlan_config), GFP_KERNEL);
if (!c)
return NULL;
@@ -355,7 +355,7 @@ switch_vlan_config *switch_parse_vlan(switch_driver *driver, char *buf)
u = ((j == driver->cpuport) ? 0 : 1);
p = 0;
s = !(*buf >= '0' && *buf <= '9');
-
+
if (s) {
while (s && !isspace(*buf) && (*buf != 0)) {
switch(*buf) {
@@ -379,7 +379,7 @@ switch_vlan_config *switch_parse_vlan(switch_driver *driver, char *buf)
j = 0;
}
-
+
while (isspace(*buf)) buf++;
}
if (*buf != 0) return NULL;
@@ -387,7 +387,7 @@ switch_vlan_config *switch_parse_vlan(switch_driver *driver, char *buf)
c->port &= (1 << driver->ports) - 1;
c->untag &= (1 << driver->ports) - 1;
c->pvid &= (1 << driver->ports) - 1;
-
+
return c;
}
@@ -467,7 +467,7 @@ static int __init switch_init(void)
}
INIT_LIST_HEAD(&drivers.list);
-
+
return 0;
}
diff --git a/package/switch/src/switch-robo.c b/package/switch/src/switch-robo.c
index 7884bd8b6a..2fca360578 100644
--- a/package/switch/src/switch-robo.c
+++ b/package/switch/src/switch-robo.c
@@ -125,7 +125,7 @@ static u16 mdio_read(__u16 phy_id, __u8 reg)
"[%s:%d] SIOCGETCPHYRD failed!\n", __FILE__, __LINE__);
return 0xffff;
}
-
+
return args[1];
} else {
struct mii_ioctl_data *mii = (struct mii_ioctl_data *) &robo.ifr.ifr_data;
@@ -155,7 +155,7 @@ static void mdio_write(__u16 phy_id, __u8 reg, __u16 val)
return;
}
-
+
if (do_ioctl(SIOCSETCPHYWR, args) < 0) {
printk(KERN_ERR PFX
"[%s:%d] SIOCGETCPHYWR failed!\n", __FILE__, __LINE__);
@@ -179,13 +179,13 @@ static void mdio_write(__u16 phy_id, __u8 reg, __u16 val)
static int robo_reg(__u8 page, __u8 reg, __u8 op)
{
int i = 3;
-
+
/* set page number */
- mdio_write(robo.phy_addr, REG_MII_PAGE,
+ mdio_write(robo.phy_addr, REG_MII_PAGE,
(page << 8) | REG_MII_PAGE_ENABLE);
-
+
/* set register address */
- mdio_write(robo.phy_addr, REG_MII_ADDR,
+ mdio_write(robo.phy_addr, REG_MII_ADDR,
(reg << 8) | op);
/* check if operation completed */
@@ -195,7 +195,7 @@ static int robo_reg(__u8 page, __u8 reg, __u8 op)
}
printk(KERN_ERR PFX "[%s:%d] timeout in robo_reg!\n", __FILE__, __LINE__);
-
+
return 0;
}
@@ -203,9 +203,9 @@ static int robo_reg(__u8 page, __u8 reg, __u8 op)
static void robo_read(__u8 page, __u8 reg, __u16 *val, int count)
{
int i;
-
+
robo_reg(page, reg, REG_MII_ADDR_READ);
-
+
for (i = 0; i < count; i++)
val[i] = mdio_read(robo.phy_addr, REG_MII_DATA0 + i);
}
@@ -214,14 +214,14 @@ static void robo_read(__u8 page, __u8 reg, __u16 *val, int count)
static __u16 robo_read16(__u8 page, __u8 reg)
{
robo_reg(page, reg, REG_MII_ADDR_READ);
-
+
return mdio_read(robo.phy_addr, REG_MII_DATA0);
}
static __u32 robo_read32(__u8 page, __u8 reg)
{
robo_reg(page, reg, REG_MII_ADDR_READ);
-
+
return mdio_read(robo.phy_addr, REG_MII_DATA0) +
(mdio_read(robo.phy_addr, REG_MII_DATA0 + 1) << 16);
}
@@ -239,7 +239,7 @@ static void robo_write32(__u8 page, __u8 reg, __u32 val32)
/* write data */
mdio_write(robo.phy_addr, REG_MII_DATA0, val32 & 65535);
mdio_write(robo.phy_addr, REG_MII_DATA0 + 1, val32 >> 16);
-
+
robo_reg(page, reg, REG_MII_ADDR_WRITE);
}
@@ -249,7 +249,7 @@ static int robo_vlan5350(void)
/* set vlan access id to 15 and read it back */
__u16 val16 = 15;
robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_TABLE_ACCESS_5350, val16);
-
+
/* 5365 will refuse this as it does not have this reg */
return (robo_read16(ROBO_VLAN_PAGE, ROBO_VLAN_TABLE_ACCESS_5350) == val16);
}
@@ -376,7 +376,7 @@ static int handle_vlan_port_read(void *driver, char *buf, int nr)
int j;
val16 = (nr) /* vlan */ | (0 << 12) /* read */ | (1 << 13) /* enable */;
-
+
if (robo.is_5350) {
u32 val32;
robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_TABLE_ACCESS_5350, val16);
@@ -398,7 +398,7 @@ static int handle_vlan_port_read(void *driver, char *buf, int nr)
}
len += sprintf(buf + len, "\n");
}
- } else {
+ } else {
robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_TABLE_ACCESS, val16);
/* actual read */
val16 = robo_read16(ROBO_VLAN_PAGE, ROBO_VLAN_READ);
@@ -431,7 +431,7 @@ static int handle_vlan_port_write(void *driver, char *buf, int nr)
switch_vlan_config *c = switch_parse_vlan(d, buf);
int j;
__u16 val16;
-
+
if (c == NULL)
return -EINVAL;
@@ -490,7 +490,7 @@ static int handle_enable_vlan_read(void *driver, char *buf, int nr)
static int handle_enable_vlan_write(void *driver, char *buf, int nr)
{
int disable = ((buf[0] != '1') ? 1 : 0);
-
+
robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_CTRL0, disable ? 0 :
(1 << 7) /* 802.1Q VLAN */ | (3 << 5) /* mac check and hash */);
robo_write16(ROBO_VLAN_PAGE, ROBO_VLAN_CTRL1, disable ? 0 :
@@ -514,7 +514,7 @@ static int handle_reset(void *driver, char *buf, int nr)
switch_vlan_config *c = switch_parse_vlan(d, buf);
int j;
__u16 val16;
-
+
if (c == NULL)
return -EINVAL;
@@ -560,7 +560,7 @@ static int __init robo_init(void)
notfound = robo_probe(device);
}
device[3]--;
-
+
if (notfound) {
kfree(device);
return -ENODEV;