Commit d37224c6 authored by Andrew Morton's avatar Andrew Morton Committed by Christoph Hellwig

[PATCH] simple mwave code cleanup

From: Paul B Schroeder <paulsch@haywired.net>

The following patch simply moves the 'nr_registered_attrs' and
'device_registered' variables in mwavedd.c into the MWAVE_DEVICE_DATA struct
which is defined in mwavedd.h..
parent 6fc1e309
...@@ -502,8 +502,6 @@ static struct device_attribute * const mwave_dev_attrs[] = { ...@@ -502,8 +502,6 @@ static struct device_attribute * const mwave_dev_attrs[] = {
&dev_attr_uart_irq, &dev_attr_uart_irq,
&dev_attr_uart_io, &dev_attr_uart_io,
}; };
static int nr_registered_attrs;
static int device_registered;
/* /*
* mwave_init is called on module load * mwave_init is called on module load
...@@ -518,13 +516,13 @@ static void mwave_exit(void) ...@@ -518,13 +516,13 @@ static void mwave_exit(void)
PRINTK_1(TRACE_MWAVE, "mwavedd::mwave_exit entry\n"); PRINTK_1(TRACE_MWAVE, "mwavedd::mwave_exit entry\n");
for (i = 0; i < nr_registered_attrs; i++) for (i = 0; i < pDrvData->nr_registered_attrs; i++)
device_remove_file(&mwave_device, mwave_dev_attrs[i]); device_remove_file(&mwave_device, mwave_dev_attrs[i]);
nr_registered_attrs = 0; pDrvData->nr_registered_attrs = 0;
if (device_registered) { if (pDrvData->device_registered) {
device_unregister(&mwave_device); device_unregister(&mwave_device);
device_registered = 0; pDrvData->device_registered = FALSE;
} }
if ( pDrvData->sLine >= 0 ) { if ( pDrvData->sLine >= 0 ) {
...@@ -650,7 +648,7 @@ static int __init mwave_init(void) ...@@ -650,7 +648,7 @@ static int __init mwave_init(void)
if (device_register(&mwave_device)) if (device_register(&mwave_device))
goto cleanup_error; goto cleanup_error;
device_registered = 1; pDrvData->device_registered = TRUE;
for (i = 0; i < ARRAY_SIZE(mwave_dev_attrs); i++) { for (i = 0; i < ARRAY_SIZE(mwave_dev_attrs); i++) {
if(device_create_file(&mwave_device, mwave_dev_attrs[i])) { if(device_create_file(&mwave_device, mwave_dev_attrs[i])) {
PRINTK_ERROR(KERN_ERR_MWAVE PRINTK_ERROR(KERN_ERR_MWAVE
...@@ -659,7 +657,7 @@ static int __init mwave_init(void) ...@@ -659,7 +657,7 @@ static int __init mwave_init(void)
mwave_dev_attrs[i]->attr.name); mwave_dev_attrs[i]->attr.name);
goto cleanup_error; goto cleanup_error;
} }
nr_registered_attrs++; pDrvData->nr_registered_attrs++;
} }
/* SUCCESS! */ /* SUCCESS! */
......
...@@ -140,6 +140,8 @@ typedef struct _MWAVE_DEVICE_DATA { ...@@ -140,6 +140,8 @@ typedef struct _MWAVE_DEVICE_DATA {
MWAVE_IPC IPCs[16]; MWAVE_IPC IPCs[16];
BOOLEAN bMwaveDevRegistered; BOOLEAN bMwaveDevRegistered;
short sLine; short sLine;
int nr_registered_attrs;
int device_registered;
} MWAVE_DEVICE_DATA, *pMWAVE_DEVICE_DATA; } MWAVE_DEVICE_DATA, *pMWAVE_DEVICE_DATA;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment