summaryrefslogtreecommitdiffstats
path: root/target/linux/ifxmips/files/drivers
diff options
context:
space:
mode:
authorthl <thl@3c298f89-4303-0410-b956-a3cf2f4a3e73>2008-12-16 19:39:34 +0000
committerthl <thl@3c298f89-4303-0410-b956-a3cf2f4a3e73>2008-12-16 19:39:34 +0000
commit73a104c025f3230baa7e6e01250ca8825ee4342f (patch)
treebef25e22147228d75c8821e51e6489ab97159ed7 /target/linux/ifxmips/files/drivers
parent424b5aa79faf5193aaa59088f1e9eb9c7c9f2112 (diff)
[ifxmips] many more code cleanups for checkpatch.pl, most flagged as errors
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@13665 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ifxmips/files/drivers')
-rw-r--r--target/linux/ifxmips/files/drivers/char/ifxmips_ssc.c25
-rw-r--r--target/linux/ifxmips/files/drivers/leds/leds-ifxmips.c56
-rw-r--r--target/linux/ifxmips/files/drivers/net/ifxmips_mii0.c11
-rw-r--r--target/linux/ifxmips/files/drivers/watchdog/ifxmips_wdt.c83
4 files changed, 86 insertions, 89 deletions
diff --git a/target/linux/ifxmips/files/drivers/char/ifxmips_ssc.c b/target/linux/ifxmips/files/drivers/char/ifxmips_ssc.c
index 5d6135602..f8c5f3017 100644
--- a/target/linux/ifxmips/files/drivers/char/ifxmips_ssc.c
+++ b/target/linux/ifxmips/files/drivers/char/ifxmips_ssc.c
@@ -1251,24 +1251,13 @@ static int ssc_session(char *tx_buf, u32 tx_len, char *rx_buf, u32 rx_len)
else
eff_size = tx_len;
- //4 bytes alignment, required by driver
- /* change by TaiCheng */
- //if (in_irq()){
- if (1) {
- ssc_tx_buf = kmalloc(sizeof(char) *
- ((eff_size + 3) & (~3)),
- GFP_ATOMIC);
- ssc_rx_buf = kmalloc(sizeof(char) *
- ((eff_size + 3) & (~3)),
- GFP_ATOMIC);
- } else {
- ssc_tx_buf = kmalloc(sizeof(char) *
- ((eff_size + 3) & (~3)),
- GFP_KERNEL);
- ssc_rx_buf = kmalloc(sizeof(char) *
- ((eff_size + 3) & (~3)),
- GFP_KERNEL);
- }
+ /* 4 bytes alignment, required by driver */
+ ssc_tx_buf = kmalloc(sizeof(char) *
+ ((eff_size + 3) & (~3)),
+ GFP_ATOMIC);
+ ssc_rx_buf = kmalloc(sizeof(char) *
+ ((eff_size + 3) & (~3)),
+ GFP_ATOMIC);
if (ssc_tx_buf == NULL || ssc_rx_buf == NULL) {
printk("no memory for size of %d\n", eff_size);
ret = -ENOMEM;
diff --git a/target/linux/ifxmips/files/drivers/leds/leds-ifxmips.c b/target/linux/ifxmips/files/drivers/leds/leds-ifxmips.c
index 7efc03270..04e4ef8d0 100644
--- a/target/linux/ifxmips/files/drivers/leds/leds-ifxmips.c
+++ b/target/linux/ifxmips/files/drivers/leds/leds-ifxmips.c
@@ -14,7 +14,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Copyright (C) 2006 infineon
- * Copyright (C) 2007 John Crispin <blogic@openwrt.org>
+ * Copyright (C) 2007 John Crispin <blogic@openwrt.org>
*
*/
@@ -37,8 +37,11 @@
#define DRVNAME "ifxmips_led"
+#if 1
#define IFXMIPS_LED_CLK_EDGE IFXMIPS_LED_FALLING
-//#define IFXMIPS_LED_CLK_EDGE IFXMIPS_LED_RISING
+#else
+#define IFXMIPS_LED_CLK_EDGE IFXMIPS_LED_RISING
+#endif
#define IFXMIPS_LED_SPEED IFXMIPS_LED_8HZ
@@ -51,45 +54,47 @@ struct ifxmips_led {
u8 bit;
};
-void ifxmips_led_set (unsigned int led)
+void ifxmips_led_set(unsigned int led)
{
led &= 0xffffff;
ifxmips_w32(ifxmips_r32(IFXMIPS_LED_CPU0) | led, IFXMIPS_LED_CPU0);
}
EXPORT_SYMBOL(ifxmips_led_set);
-void ifxmips_led_clear (unsigned int led)
+void ifxmips_led_clear(unsigned int led)
{
led = ~(led & 0xffffff);
ifxmips_w32(ifxmips_r32(IFXMIPS_LED_CPU0) & led, IFXMIPS_LED_CPU0);
}
EXPORT_SYMBOL(ifxmips_led_clear);
-void ifxmips_led_blink_set (unsigned int led)
+void ifxmips_led_blink_set(unsigned int led)
{
led &= 0xffffff;
ifxmips_w32(ifxmips_r32(IFXMIPS_LED_CON0) | led, IFXMIPS_LED_CON0);
}
EXPORT_SYMBOL(ifxmips_led_blink_set);
-void ifxmips_led_blink_clear (unsigned int led)
+void ifxmips_led_blink_clear(unsigned int led)
{
led = ~(led & 0xffffff);
ifxmips_w32(ifxmips_r32(IFXMIPS_LED_CON0) & led, IFXMIPS_LED_CON0);
}
EXPORT_SYMBOL(ifxmips_led_blink_clear);
-void ifxmips_ledapi_set(struct led_classdev *led_cdev, enum led_brightness value)
+static void ifxmips_ledapi_set(struct led_classdev *led_cdev,
+ enum led_brightness value)
{
- struct ifxmips_led *led_dev = container_of(led_cdev, struct ifxmips_led, cdev);
+ struct ifxmips_led *led_dev =
+ container_of(led_cdev, struct ifxmips_led, cdev);
- if(value)
+ if (value)
ifxmips_led_set(1 << led_dev->bit);
else
ifxmips_led_clear(1 << led_dev->bit);
}
-void ifxmips_led_setup_gpio (void)
+void ifxmips_led_setup_gpio(void)
{
int i = 0;
@@ -115,28 +120,36 @@ static int ifxmips_led_probe(struct platform_device *dev)
ifxmips_w32(0, IFXMIPS_LED_CON1);
/* setup the clock edge that the shift register is triggered on */
- ifxmips_w32(ifxmips_r32(IFXMIPS_LED_CON0) & ~IFXMIPS_LED_EDGE_MASK, IFXMIPS_LED_CON0);
- ifxmips_w32(ifxmips_r32(IFXMIPS_LED_CON0) | IFXMIPS_LED_CLK_EDGE, IFXMIPS_LED_CON0);
+ ifxmips_w32(ifxmips_r32(IFXMIPS_LED_CON0) & ~IFXMIPS_LED_EDGE_MASK,
+ IFXMIPS_LED_CON0);
+ ifxmips_w32(ifxmips_r32(IFXMIPS_LED_CON0) | IFXMIPS_LED_CLK_EDGE,
+ IFXMIPS_LED_CON0);
/* per default leds 15-0 are set */
ifxmips_w32(IFXMIPS_LED_GROUP1 | IFXMIPS_LED_GROUP0, IFXMIPS_LED_CON1);
/* leds are update periodically by the FPID */
- ifxmips_w32(ifxmips_r32(IFXMIPS_LED_CON1) & ~IFXMIPS_LED_UPD_MASK, IFXMIPS_LED_CON1);
- ifxmips_w32(ifxmips_r32(IFXMIPS_LED_CON1) | IFXMIPS_LED_UPD_SRC_FPI, IFXMIPS_LED_CON1);
+ ifxmips_w32(ifxmips_r32(IFXMIPS_LED_CON1) & ~IFXMIPS_LED_UPD_MASK,
+ IFXMIPS_LED_CON1);
+ ifxmips_w32(ifxmips_r32(IFXMIPS_LED_CON1) | IFXMIPS_LED_UPD_SRC_FPI,
+ IFXMIPS_LED_CON1);
/* set led update speed */
- ifxmips_w32(ifxmips_r32(IFXMIPS_LED_CON1) & ~IFXMIPS_LED_MASK, IFXMIPS_LED_CON1);
- ifxmips_w32(ifxmips_r32(IFXMIPS_LED_CON1) | IFXMIPS_LED_SPEED, IFXMIPS_LED_CON1);
+ ifxmips_w32(ifxmips_r32(IFXMIPS_LED_CON1) & ~IFXMIPS_LED_MASK,
+ IFXMIPS_LED_CON1);
+ ifxmips_w32(ifxmips_r32(IFXMIPS_LED_CON1) | IFXMIPS_LED_SPEED,
+ IFXMIPS_LED_CON1);
/* adsl 0 and 1 leds are updated by the arc */
- ifxmips_w32(ifxmips_r32(IFXMIPS_LED_CON0) | IFXMIPS_LED_ADSL_SRC, IFXMIPS_LED_CON0);
+ ifxmips_w32(ifxmips_r32(IFXMIPS_LED_CON0) | IFXMIPS_LED_ADSL_SRC,
+ IFXMIPS_LED_CON0);
/* per default, the leds are turned on */
ifxmips_pmu_enable(IFXMIPS_PMU_PWDCR_LED);
for (i = 0; i < IFXMIPS_MAX_LED; i++) {
- struct ifxmips_led *tmp = kzalloc(sizeof(struct ifxmips_led), GFP_KERNEL);
+ struct ifxmips_led *tmp =
+ kzalloc(sizeof(struct ifxmips_led), GFP_KERNEL);
tmp->cdev.brightness_set = ifxmips_ledapi_set;
tmp->cdev.name = kmalloc(sizeof("ifxmips:led:00"), GFP_KERNEL);
sprintf((char *)tmp->cdev.name, "ifxmips:led:%02d", i);
@@ -162,16 +175,17 @@ static struct platform_driver ifxmips_led_driver = {
},
};
-int __init ifxmips_led_init (void)
+int __init ifxmips_led_init(void)
{
int ret = platform_driver_register(&ifxmips_led_driver);
if (ret)
- printk(KERN_INFO "ifxmips_led: Error registering platfom driver!");
+ printk(KERN_INFO
+ "ifxmips_led: Error registering platfom driver!");
return ret;
}
-void __exit ifxmips_led_exit (void)
+void __exit ifxmips_led_exit(void)
{
platform_driver_unregister(&ifxmips_led_driver);
}
diff --git a/target/linux/ifxmips/files/drivers/net/ifxmips_mii0.c b/target/linux/ifxmips/files/drivers/net/ifxmips_mii0.c
index 695e0b77a..1185a1537 100644
--- a/target/linux/ifxmips/files/drivers/net/ifxmips_mii0.c
+++ b/target/linux/ifxmips/files/drivers/net/ifxmips_mii0.c
@@ -55,7 +55,8 @@ void ifxmips_write_mdio(u32 phy_addr, u32 phy_reg, u16 phy_data)
((phy_reg & MDIO_ACC_REG_MASK) << MDIO_ACC_REG_OFFSET) |
phy_data;
- while (ifxmips_r32(IFXMIPS_PPE32_MDIO_ACC) & MDIO_ACC_REQUEST);
+ while (ifxmips_r32(IFXMIPS_PPE32_MDIO_ACC) & MDIO_ACC_REQUEST)
+ ;
ifxmips_w32(val, IFXMIPS_PPE32_MDIO_ACC);
}
EXPORT_SYMBOL(ifxmips_write_mdio);
@@ -66,9 +67,11 @@ unsigned short ifxmips_read_mdio(u32 phy_addr, u32 phy_reg)
((phy_addr & MDIO_ACC_ADDR_MASK) << MDIO_ACC_ADDR_OFFSET) |
((phy_reg & MDIO_ACC_REG_MASK) << MDIO_ACC_REG_OFFSET);
- while (ifxmips_r32(IFXMIPS_PPE32_MDIO_ACC) & MDIO_ACC_REQUEST) ;
+ while (ifxmips_r32(IFXMIPS_PPE32_MDIO_ACC) & MDIO_ACC_REQUEST)
+ ;
ifxmips_w32(val, IFXMIPS_PPE32_MDIO_ACC);
- while (ifxmips_r32(IFXMIPS_PPE32_MDIO_ACC) & MDIO_ACC_REQUEST) ;
+ while (ifxmips_r32(IFXMIPS_PPE32_MDIO_ACC) & MDIO_ACC_REQUEST)
+ ;
val = ifxmips_r32(IFXMIPS_PPE32_MDIO_ACC) & MDIO_ACC_VAL_MASK;
return val;
}
@@ -302,7 +305,7 @@ static int ifxmips_mii_dev_init(struct net_device *dev)
printk(KERN_INFO "ifxmips_mii0: using mac=");
for (i = 0; i < 6; i++) {
dev->dev_addr[i] = mac_addr[i];
- printk("%02X%c", dev->dev_addr[i], (i == 5)?('\n'):(':'));
+ printk("%02X%c", dev->dev_addr[i], (i == 5) ? ('\n') : (':'));
}
return 0;
}
diff --git a/target/linux/ifxmips/files/drivers/watchdog/ifxmips_wdt.c b/target/linux/ifxmips/files/drivers/watchdog/ifxmips_wdt.c
index 58e216148..e62d2fec3 100644
--- a/target/linux/ifxmips/files/drivers/watchdog/ifxmips_wdt.c
+++ b/target/linux/ifxmips/files/drivers/watchdog/ifxmips_wdt.c
@@ -3,7 +3,7 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -23,36 +23,35 @@
#include <linux/miscdevice.h>
#include <linux/watchdog.h>
#include <linux/platform_device.h>
-#include <asm/uaccess.h>
-#include <asm-mips/ifxmips/ifxmips_cgu.h>
-#include <asm-mips/ifxmips/ifxmips.h>
+#include <linux/uaccess.h>
+
+#include <asm/ifxmips/ifxmips_cgu.h>
+#include <asm/ifxmips/ifxmips.h>
-#define IFXMIPS_WDT_PW1 0x00BE0000
-#define IFXMIPS_WDT_PW2 0x00DC0000
+#define IFXMIPS_WDT_PW1 0x00BE0000
+#define IFXMIPS_WDT_PW2 0x00DC0000
#ifndef CONFIG_WATCHDOG_NOWAYOUT
-static int wdt_ok_to_close = 0;
+static int wdt_ok_to_close;
#endif
-int wdt_timeout = 30;
+static int wdt_timeout = 30;
-int
-ifxmips_wdt_enable(unsigned int timeout)
+int ifxmips_wdt_enable(unsigned int timeout)
{
u32 fpi;
fpi = cgu_get_io_region_clock();
ifxmips_w32(IFXMIPS_WDT_PW1, IFXMIPS_BIU_WDT_CR);
ifxmips_w32(IFXMIPS_WDT_PW2 |
- (0x3 << 26) | // PWL
- (0x3 << 24) | // CLKDIV
- (0x1 << 31) | // enable
- ((timeout * (fpi / 0x40000)) + 0x1000), // reload
+ (0x3 << 26) | /* PWL */
+ (0x3 << 24) | /* CLKDIV */
+ (0x1 << 31) | /* enable */
+ ((timeout * (fpi / 0x40000)) + 0x1000), /* reload */
IFXMIPS_BIU_WDT_CR);
return 0;
}
-void
-ifxmips_wdt_disable(void)
+void ifxmips_wdt_disable(void)
{
#ifndef CONFIG_WATCHDOG_NOWAYOUT
wdt_ok_to_close = 0;
@@ -61,22 +60,20 @@ ifxmips_wdt_disable(void)
ifxmips_w32(IFXMIPS_WDT_PW2, IFXMIPS_BIU_WDT_CR);
}
-static ssize_t
-ifxmips_wdt_write(struct file *file, const char __user *data, size_t len,
- loff_t *ppos)
+static ssize_t ifxmips_wdt_write(struct file *file, const char __user *data,
+ size_t len, loff_t *ppos)
{
size_t i;
- if(!len)
+ if (!len)
return 0;
#ifndef CONFIG_WATCHDOG_NOWAYOUT
- for(i = 0; i != len; i++)
- {
+ for (i = 0; i != len; i++) {
char c;
- if(get_user(c, data + i))
+ if (get_user(c, data + i))
return -EFAULT;
- if(c == 'V')
+ if (c == 'V')
wdt_ok_to_close = 1;
}
#endif
@@ -89,14 +86,12 @@ static struct watchdog_info ident = {
.identity = "ifxmips Watchdog",
};
-static int
-ifxmips_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
- unsigned long arg)
+static int ifxmips_wdt_ioctl(struct inode *inode, struct file *file,
+ unsigned int cmd, unsigned long arg)
{
int ret = -ENOTTY;
- switch(cmd)
- {
+ switch (cmd) {
case WDIOC_GETSUPPORT:
ret = copy_to_user((struct watchdog_info __user *)arg, &ident,
sizeof(ident)) ? -EFAULT : 0;
@@ -107,7 +102,7 @@ ifxmips_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
break;
case WDIOC_SETTIMEOUT:
- ret = get_user(wdt_timeout, (int __user*)arg);
+ ret = get_user(wdt_timeout, (int __user *)arg);
break;
case WDIOC_KEEPALIVE:
@@ -118,8 +113,7 @@ ifxmips_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
return ret;
}
-static int
-ifxmips_wdt_open(struct inode *inode, struct file *file)
+static int ifxmips_wdt_open(struct inode *inode, struct file *file)
{
ifxmips_wdt_enable(wdt_timeout);
return nonseekable_open(inode, file);
@@ -128,11 +122,12 @@ ifxmips_wdt_open(struct inode *inode, struct file *file)
static int ifxmips_wdt_release(struct inode *inode, struct file *file)
{
#ifndef CONFIG_WATCHDOG_NOWAYOUT
- if(wdt_ok_to_close)
+ if (wdt_ok_to_close)
ifxmips_wdt_disable();
else
#endif
- printk("ifxmips_wdt: watchdog closed without warning, rebooting system\n");
+ printk(KERN_ERR "ifxmips_wdt: watchdog closed without warning,"
+ " rebooting system\n");
return 0;
}
@@ -150,20 +145,18 @@ static struct miscdevice ifxmips_wdt_miscdev = {
.fops = &ifxmips_wdt_fops,
};
-static int
-ifxmips_wdt_probe(struct platform_device *dev)
+static int ifxmips_wdt_probe(struct platform_device *dev)
{
int err;
err = misc_register(&ifxmips_wdt_miscdev);
- if(err)
- printk("ifxmips_wdt: error creating device\n");
+ if (err)
+ printk(KERN_INFO "ifxmips_wdt: error creating device\n");
else
- printk("ifxmips_wdt: loaded\n");
+ printk(KERN_INFO "ifxmips_wdt: loaded\n");
return err;
}
-static int
-ifxmips_wdt_remove(struct platform_device *dev)
+static int ifxmips_wdt_remove(struct platform_device *dev)
{
ifxmips_wdt_disable();
misc_deregister(&ifxmips_wdt_miscdev);
@@ -180,17 +173,15 @@ static struct platform_driver ifxmips_wdt_driver = {
},
};
-static int __init
-init_ifxmips_wdt(void)
+static int __init init_ifxmips_wdt(void)
{
int ret = platform_driver_register(&ifxmips_wdt_driver);
- if(ret)
+ if (ret)
printk(KERN_INFO "ifxmips_wdt: error registering platfom driver!");
return ret;
}
-static void __exit
-exit_ifxmips_wdt(void)
+static void __exit exit_ifxmips_wdt(void)
{
platform_driver_unregister(&ifxmips_wdt_driver);
}