Staging: rar: Fix all coding style issues.
This fixes all coding style issues and some spelling mistakes. Signed-off-by: Benjamin Adolphi <b.adolphi@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
88e05d854c
commit
f3557cc180
|
@ -68,7 +68,8 @@ static void __exit rar_exit_handler(void);
|
||||||
/*
|
/*
|
||||||
function that is activated on the successfull probe of the RAR device
|
function that is activated on the successfull probe of the RAR device
|
||||||
*/
|
*/
|
||||||
static int __devinit rar_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
|
static int __devinit rar_probe(struct pci_dev *pdev,
|
||||||
|
const struct pci_device_id *ent);
|
||||||
|
|
||||||
static struct pci_device_id rar_pci_id_tbl[] = {
|
static struct pci_device_id rar_pci_id_tbl[] = {
|
||||||
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4110) },
|
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4110) },
|
||||||
|
@ -86,9 +87,9 @@ static struct pci_driver rar_pci_driver = {
|
||||||
|
|
||||||
/* This function is used to retrieved RAR info using the IPC message
|
/* This function is used to retrieved RAR info using the IPC message
|
||||||
bus interface */
|
bus interface */
|
||||||
static int memrar_get_rar_addr(struct pci_dev* pdev,
|
static int memrar_get_rar_addr(struct pci_dev *pdev,
|
||||||
int offset,
|
int offset,
|
||||||
u32 *addr)
|
u32 *addr)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* ======== The Lincroft Message Bus Interface ========
|
* ======== The Lincroft Message Bus Interface ========
|
||||||
|
@ -140,29 +141,29 @@ static int memrar_get_rar_addr(struct pci_dev* pdev,
|
||||||
| (offset << 8)
|
| (offset << 8)
|
||||||
| (LNC_MESSAGE_BYTE_WRITE_ENABLES << 4);
|
| (LNC_MESSAGE_BYTE_WRITE_ENABLES << 4);
|
||||||
|
|
||||||
printk(KERN_WARNING "rar- offset to LNC MSG is %x\n",offset);
|
printk(KERN_WARNING "rar- offset to LNC MSG is %x\n", offset);
|
||||||
|
|
||||||
if (addr == 0)
|
if (addr == 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* Send the control message */
|
/* Send the control message */
|
||||||
result = pci_write_config_dword(pdev,
|
result = pci_write_config_dword(pdev,
|
||||||
LNC_MCR_OFFSET,
|
LNC_MCR_OFFSET,
|
||||||
message);
|
message);
|
||||||
|
|
||||||
printk(KERN_WARNING "rar- result from send ctl register is %x\n"
|
printk(KERN_WARNING "rar- result from send ctl register is %x\n",
|
||||||
,result);
|
result);
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
result = pci_read_config_dword(pdev,
|
result = pci_read_config_dword(pdev,
|
||||||
LNC_MDR_OFFSET,
|
LNC_MDR_OFFSET,
|
||||||
addr);
|
addr);
|
||||||
|
|
||||||
printk(KERN_WARNING "rar- result from read data register is %x\n",
|
printk(KERN_WARNING "rar- result from read data register is %x\n",
|
||||||
result);
|
result);
|
||||||
|
|
||||||
printk(KERN_WARNING "rar- value read from data register is %x\n",
|
printk(KERN_WARNING "rar- value read from data register is %x\n",
|
||||||
*addr);
|
*addr);
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -170,9 +171,9 @@ static int memrar_get_rar_addr(struct pci_dev* pdev,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int memrar_set_rar_addr(struct pci_dev* pdev,
|
static int memrar_set_rar_addr(struct pci_dev *pdev,
|
||||||
int offset,
|
int offset,
|
||||||
u32 addr)
|
u32 addr)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* ======== The Lincroft Message Bus Interface ========
|
* ======== The Lincroft Message Bus Interface ========
|
||||||
|
@ -225,29 +226,29 @@ static int memrar_set_rar_addr(struct pci_dev* pdev,
|
||||||
| (offset << 8)
|
| (offset << 8)
|
||||||
| (LNC_MESSAGE_BYTE_WRITE_ENABLES << 4);
|
| (LNC_MESSAGE_BYTE_WRITE_ENABLES << 4);
|
||||||
|
|
||||||
printk(KERN_WARNING "rar- offset to LNC MSG is %x\n",offset);
|
printk(KERN_WARNING "rar- offset to LNC MSG is %x\n", offset);
|
||||||
|
|
||||||
if (addr == 0)
|
if (addr == 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* Send the control message */
|
/* Send the control message */
|
||||||
result = pci_write_config_dword(pdev,
|
result = pci_write_config_dword(pdev,
|
||||||
LNC_MDR_OFFSET,
|
LNC_MDR_OFFSET,
|
||||||
addr);
|
addr);
|
||||||
|
|
||||||
printk(KERN_WARNING "rar- result from send ctl register is %x\n"
|
printk(KERN_WARNING "rar- result from send ctl register is %x\n",
|
||||||
,result);
|
result);
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
result = pci_write_config_dword(pdev,
|
result = pci_write_config_dword(pdev,
|
||||||
LNC_MCR_OFFSET,
|
LNC_MCR_OFFSET,
|
||||||
message);
|
message);
|
||||||
|
|
||||||
printk(KERN_WARNING "rar- result from write data register is %x\n",
|
printk(KERN_WARNING "rar- result from write data register is %x\n",
|
||||||
result);
|
result);
|
||||||
|
|
||||||
printk(KERN_WARNING "rar- value read to data register is %x\n",
|
printk(KERN_WARNING "rar- value read to data register is %x\n",
|
||||||
addr);
|
addr);
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -284,35 +285,36 @@ static int memrar_init_rar_params(struct pci_dev *pdev)
|
||||||
/* struct pci_dev *pdev = pci_get_bus_and_slot(0, PCI_DEVFN(0,0)); */
|
/* struct pci_dev *pdev = pci_get_bus_and_slot(0, PCI_DEVFN(0,0)); */
|
||||||
|
|
||||||
if (pdev == NULL)
|
if (pdev == NULL)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
for (i = offsets; i != end; ++i, ++n) {
|
for (i = offsets; i != end; ++i, ++n) {
|
||||||
if (memrar_get_rar_addr (pdev,
|
if (memrar_get_rar_addr(pdev,
|
||||||
(*i).low,
|
(*i).low,
|
||||||
&(rar_addr[n].low)) != 0
|
&(rar_addr[n].low)) != 0
|
||||||
|| memrar_get_rar_addr (pdev,
|
|| memrar_get_rar_addr(pdev,
|
||||||
(*i).high,
|
(*i).high,
|
||||||
&(rar_addr[n].high)) != 0) {
|
&(rar_addr[n].high)) != 0) {
|
||||||
result = -1;
|
result = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Done accessing the device. */
|
/* Done accessing the device. */
|
||||||
/* pci_dev_put(pdev); */
|
/* pci_dev_put(pdev); */
|
||||||
|
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
if(1) {
|
if (1) {
|
||||||
size_t z;
|
size_t z;
|
||||||
for (z = 0; z != MRST_NUM_RAR; ++z) {
|
for (z = 0; z != MRST_NUM_RAR; ++z) {
|
||||||
printk(KERN_WARNING "rar - BRAR[%Zd] physical address low\n"
|
printk(KERN_WARNING
|
||||||
"\tlow: 0x%08x\n"
|
"rar - BRAR[%Zd] physical address low\n"
|
||||||
"\thigh: 0x%08x\n",
|
"\tlow: 0x%08x\n"
|
||||||
z,
|
"\thigh: 0x%08x\n",
|
||||||
rar_addr[z].low,
|
z,
|
||||||
rar_addr[z].high);
|
rar_addr[z].low,
|
||||||
|
rar_addr[z].high);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -321,7 +323,8 @@ static int memrar_init_rar_params(struct pci_dev *pdev)
|
||||||
/*
|
/*
|
||||||
function that is activated on the successfull probe of the RAR device
|
function that is activated on the successfull probe of the RAR device
|
||||||
*/
|
*/
|
||||||
static int __devinit rar_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
static int __devinit rar_probe(struct pci_dev *pdev,
|
||||||
|
const struct pci_device_id *ent)
|
||||||
{
|
{
|
||||||
/* error */
|
/* error */
|
||||||
int error;
|
int error;
|
||||||
|
@ -347,7 +350,7 @@ static int __devinit rar_probe(struct pci_dev *pdev, const struct pci_device_id
|
||||||
|
|
||||||
/* Initialize the RAR parameters, which have to be retrieved */
|
/* Initialize the RAR parameters, which have to be retrieved */
|
||||||
/* via the message bus service */
|
/* via the message bus service */
|
||||||
error=memrar_init_rar_params(rar_dev);
|
error = memrar_init_rar_params(rar_dev);
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
DEBUG_PRINT_0(RAR_DEBUG_LEVEL_EXTENDED,
|
DEBUG_PRINT_0(RAR_DEBUG_LEVEL_EXTENDED,
|
||||||
|
@ -362,8 +365,8 @@ end_function:
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
this function registers th driver to
|
this function registers the driver to
|
||||||
the device subsystem( either PCI, USB, etc)
|
the device subsystem (either PCI, USB, etc)
|
||||||
*/
|
*/
|
||||||
static int __init rar_init_handler(void)
|
static int __init rar_init_handler(void)
|
||||||
{
|
{
|
||||||
|
@ -396,25 +399,20 @@ MODULE_LICENSE("GPL");
|
||||||
* The function returns a 0 upon success or a -1 if there is no RAR
|
* The function returns a 0 upon success or a -1 if there is no RAR
|
||||||
* facility on this system.
|
* facility on this system.
|
||||||
*/
|
*/
|
||||||
int get_rar_address(int rar_index,struct RAR_address_struct *addresses)
|
int get_rar_address(int rar_index, struct RAR_address_struct *addresses)
|
||||||
{
|
{
|
||||||
if (registered && (rar_index < 3) && (rar_index >= 0)) {
|
if (registered && (rar_index < 3) && (rar_index >= 0)) {
|
||||||
*addresses=rar_addr[rar_index];
|
*addresses = rar_addr[rar_index];
|
||||||
/* strip off lock bit information */
|
/* strip off lock bit information */
|
||||||
addresses->low = addresses->low & 0xfffffff0;
|
addresses->low = addresses->low & 0xfffffff0;
|
||||||
addresses->high = addresses->high & 0xfffffff0;
|
addresses->high = addresses->high & 0xfffffff0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
} else
|
||||||
|
|
||||||
else {
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EXPORT_SYMBOL(get_rar_address);
|
EXPORT_SYMBOL(get_rar_address);
|
||||||
|
|
||||||
/* The lock_rar function is ued by other device drivers to lock an RAR.
|
/* The lock_rar function is used by other device drivers to lock an RAR.
|
||||||
* once an RAR is locked, it stays locked until the next system reboot.
|
* once an RAR is locked, it stays locked until the next system reboot.
|
||||||
* The function takes one parameter:
|
* The function takes one parameter:
|
||||||
*
|
*
|
||||||
|
@ -429,16 +427,14 @@ int lock_rar(int rar_index)
|
||||||
{
|
{
|
||||||
u32 working_addr;
|
u32 working_addr;
|
||||||
int result;
|
int result;
|
||||||
if (registered && (rar_index < 3) && (rar_index >= 0)) {
|
|
||||||
/* first make sure that lock bits are clear (this does lock) */
|
|
||||||
working_addr=rar_addr[rar_index].low & 0xfffffff0;
|
|
||||||
|
|
||||||
/* now send that value to the register using the IPC */
|
if (registered && (rar_index < 3) && (rar_index >= 0)) {
|
||||||
result=memrar_set_rar_addr(rar_dev,rar_index,working_addr);
|
/* first make sure that lock bits are clear (this does lock) */
|
||||||
return result;
|
working_addr = rar_addr[rar_index].low & 0xfffffff0;
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
/* now send that value to the register using the IPC */
|
||||||
return -ENODEV;
|
result = memrar_set_rar_addr(rar_dev, rar_index, working_addr);
|
||||||
}
|
return result;
|
||||||
|
} else
|
||||||
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* === RAR Physical Addresses === */
|
/* === RAR Physical Addresses === */
|
||||||
struct RAR_address_struct {
|
struct RAR_address_struct {
|
||||||
u32 low;
|
u32 low;
|
||||||
u32 high;
|
u32 high;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The get_rar_address function is used by other device drivers
|
/* The get_rar_address function is used by other device drivers
|
||||||
|
@ -19,10 +19,10 @@ struct RAR_address_struct {
|
||||||
* The function returns a 0 upon success or a -1 if there is no RAR
|
* The function returns a 0 upon success or a -1 if there is no RAR
|
||||||
* facility on this system.
|
* facility on this system.
|
||||||
*/
|
*/
|
||||||
int get_rar_address(int rar_index,struct RAR_address_struct *addresses);
|
int get_rar_address(int rar_index, struct RAR_address_struct *addresses);
|
||||||
|
|
||||||
|
|
||||||
/* The lock_rar function is ued by other device drivers to lock an RAR.
|
/* The lock_rar function is used by other device drivers to lock an RAR.
|
||||||
* once an RAR is locked, it stays locked until the next system reboot.
|
* once an RAR is locked, it stays locked until the next system reboot.
|
||||||
* The function takes one parameter:
|
* The function takes one parameter:
|
||||||
*
|
*
|
||||||
|
@ -49,51 +49,41 @@ int lock_rar(int rar_index);
|
||||||
|
|
||||||
/* debug macro without paramaters */
|
/* debug macro without paramaters */
|
||||||
#define DEBUG_PRINT_0(DEBUG_LEVEL , info) \
|
#define DEBUG_PRINT_0(DEBUG_LEVEL , info) \
|
||||||
do \
|
do { \
|
||||||
{ \
|
if (DEBUG_LEVEL) { \
|
||||||
if(DEBUG_LEVEL) \
|
printk(KERN_WARNING info); \
|
||||||
{ \
|
} \
|
||||||
printk(KERN_WARNING info); \
|
} while (0)
|
||||||
} \
|
|
||||||
}while(0)
|
|
||||||
|
|
||||||
/* debug macro with 1 paramater */
|
/* debug macro with 1 paramater */
|
||||||
#define DEBUG_PRINT_1(DEBUG_LEVEL , info , param1) \
|
#define DEBUG_PRINT_1(DEBUG_LEVEL , info , param1) \
|
||||||
do \
|
do { \
|
||||||
{ \
|
if (DEBUG_LEVEL) { \
|
||||||
if(DEBUG_LEVEL) \
|
printk(KERN_WARNING info , param1); \
|
||||||
{ \
|
} \
|
||||||
printk(KERN_WARNING info , param1); \
|
} while (0)
|
||||||
} \
|
|
||||||
}while(0)
|
|
||||||
|
|
||||||
/* debug macro with 2 paramaters */
|
/* debug macro with 2 paramaters */
|
||||||
#define DEBUG_PRINT_2(DEBUG_LEVEL , info , param1, param2) \
|
#define DEBUG_PRINT_2(DEBUG_LEVEL , info , param1, param2) \
|
||||||
do \
|
do { \
|
||||||
{ \
|
if (DEBUG_LEVEL) { \
|
||||||
if(DEBUG_LEVEL) \
|
printk(KERN_WARNING info , param1, param2); \
|
||||||
{ \
|
} \
|
||||||
printk(KERN_WARNING info , param1, param2); \
|
} while (0)
|
||||||
} \
|
|
||||||
}while(0)
|
|
||||||
|
|
||||||
/* debug macro with 3 paramaters */
|
/* debug macro with 3 paramaters */
|
||||||
#define DEBUG_PRINT_3(DEBUG_LEVEL , info , param1, param2 , param3) \
|
#define DEBUG_PRINT_3(DEBUG_LEVEL , info , param1, param2 , param3) \
|
||||||
do \
|
do { \
|
||||||
{ \
|
if (DEBUG_LEVEL) { \
|
||||||
if(DEBUG_LEVEL) \
|
printk(KERN_WARNING info , param1, param2 , param3); \
|
||||||
{ \
|
} \
|
||||||
printk(KERN_WARNING info , param1, param2 , param3); \
|
} while (0)
|
||||||
} \
|
|
||||||
}while(0)
|
|
||||||
|
|
||||||
/* debug macro with 4 paramaters */
|
/* debug macro with 4 paramaters */
|
||||||
#define DEBUG_PRINT_4(DEBUG_LEVEL , info , param1, param2 , param3 , param4) \
|
#define DEBUG_PRINT_4(DEBUG_LEVEL , info , param1, param2 , param3 , param4) \
|
||||||
do \
|
do { \
|
||||||
{ \
|
if (DEBUG_LEVEL) { \
|
||||||
if(DEBUG_LEVEL) \
|
printk(KERN_WARNING info , param1, param2 , param3 , param4); \
|
||||||
{ \
|
} \
|
||||||
printk(KERN_WARNING info , param1, param2 , param3 , param4); \
|
} while (0)
|
||||||
} \
|
|
||||||
}while(0)
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue