Skip to content

Commit 80e7bba

Browse files
himangi774tiwai
authored andcommitted
sound: oss: uart401: Remove typedef uart401_devc
The Linux kernel coding style guidelines suggest not using typedefs for structure types. This patch gets rid of the typedef for uart401_devc. The following Coccinelle semantic patch detects the case. @tn@ identifier i; type td; @@ -typedef struct i { ... } -td ; @@ type tn.td; identifier tn.i; @@ -td + struct i Signed-off-by: Himangi Saraogi <himangi774@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent a509574 commit 80e7bba

1 file changed

Lines changed: 21 additions & 19 deletions

File tree

‎sound/oss/uart401.c‎

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
#include "mpu401.h"
3232

33-
typedef struct uart401_devc
33+
struct uart401_devc
3434
{
3535
int base;
3636
int irq;
@@ -41,32 +41,31 @@ typedef struct uart401_devc
4141
int my_dev;
4242
int share_irq;
4343
spinlock_t lock;
44-
}
45-
uart401_devc;
44+
};
4645

4746
#define DATAPORT (devc->base)
4847
#define COMDPORT (devc->base+1)
4948
#define STATPORT (devc->base+1)
5049

51-
static int uart401_status(uart401_devc * devc)
50+
static int uart401_status(struct uart401_devc *devc)
5251
{
5352
return inb(STATPORT);
5453
}
5554

5655
#define input_avail(devc) (!(uart401_status(devc)&INPUT_AVAIL))
5756
#define output_ready(devc) (!(uart401_status(devc)&OUTPUT_READY))
5857

59-
static void uart401_cmd(uart401_devc * devc, unsigned char cmd)
58+
static void uart401_cmd(struct uart401_devc *devc, unsigned char cmd)
6059
{
6160
outb((cmd), COMDPORT);
6261
}
6362

64-
static int uart401_read(uart401_devc * devc)
63+
static int uart401_read(struct uart401_devc *devc)
6564
{
6665
return inb(DATAPORT);
6766
}
6867

69-
static void uart401_write(uart401_devc * devc, unsigned char byte)
68+
static void uart401_write(struct uart401_devc *devc, unsigned char byte)
7069
{
7170
outb((byte), DATAPORT);
7271
}
@@ -77,10 +76,10 @@ static void uart401_write(uart401_devc * devc, unsigned char byte)
7776
#define MPU_RESET 0xFF
7877
#define UART_MODE_ON 0x3F
7978

80-
static int reset_uart401(uart401_devc * devc);
81-
static void enter_uart_mode(uart401_devc * devc);
79+
static int reset_uart401(struct uart401_devc *devc);
80+
static void enter_uart_mode(struct uart401_devc *devc);
8281

83-
static void uart401_input_loop(uart401_devc * devc)
82+
static void uart401_input_loop(struct uart401_devc *devc)
8483
{
8584
int work_limit=30000;
8685

@@ -99,7 +98,7 @@ static void uart401_input_loop(uart401_devc * devc)
9998

10099
irqreturn_t uart401intr(int irq, void *dev_id)
101100
{
102-
uart401_devc *devc = dev_id;
101+
struct uart401_devc *devc = dev_id;
103102

104103
if (devc == NULL)
105104
{
@@ -118,7 +117,8 @@ uart401_open(int dev, int mode,
118117
void (*output) (int dev)
119118
)
120119
{
121-
uart401_devc *devc = (uart401_devc *) midi_devs[dev]->devc;
120+
struct uart401_devc *devc = (struct uart401_devc *)
121+
midi_devs[dev]->devc;
122122

123123
if (devc->opened)
124124
return -EBUSY;
@@ -138,7 +138,8 @@ uart401_open(int dev, int mode,
138138

139139
static void uart401_close(int dev)
140140
{
141-
uart401_devc *devc = (uart401_devc *) midi_devs[dev]->devc;
141+
struct uart401_devc *devc = (struct uart401_devc *)
142+
midi_devs[dev]->devc;
142143

143144
reset_uart401(devc);
144145
devc->opened = 0;
@@ -148,7 +149,8 @@ static int uart401_out(int dev, unsigned char midi_byte)
148149
{
149150
int timeout;
150151
unsigned long flags;
151-
uart401_devc *devc = (uart401_devc *) midi_devs[dev]->devc;
152+
struct uart401_devc *devc = (struct uart401_devc *)
153+
midi_devs[dev]->devc;
152154

153155
if (devc->disabled)
154156
return 1;
@@ -219,7 +221,7 @@ static const struct midi_operations uart401_operations =
219221
.buffer_status = uart401_buffer_status,
220222
};
221223

222-
static void enter_uart_mode(uart401_devc * devc)
224+
static void enter_uart_mode(struct uart401_devc *devc)
223225
{
224226
int ok, timeout;
225227
unsigned long flags;
@@ -241,7 +243,7 @@ static void enter_uart_mode(uart401_devc * devc)
241243
spin_unlock_irqrestore(&devc->lock,flags);
242244
}
243245

244-
static int reset_uart401(uart401_devc * devc)
246+
static int reset_uart401(struct uart401_devc *devc)
245247
{
246248
int ok, timeout, n;
247249

@@ -285,7 +287,7 @@ static int reset_uart401(uart401_devc * devc)
285287

286288
int probe_uart401(struct address_info *hw_config, struct module *owner)
287289
{
288-
uart401_devc *devc;
290+
struct uart401_devc *devc;
289291
char *name = "MPU-401 (UART) MIDI";
290292
int ok = 0;
291293
unsigned long flags;
@@ -300,7 +302,7 @@ int probe_uart401(struct address_info *hw_config, struct module *owner)
300302
return 0;
301303
}
302304

303-
devc = kmalloc(sizeof(uart401_devc), GFP_KERNEL);
305+
devc = kmalloc(sizeof(struct uart401_devc), GFP_KERNEL);
304306
if (!devc) {
305307
printk(KERN_WARNING "uart401: Can't allocate memory\n");
306308
goto cleanup_region;
@@ -392,7 +394,7 @@ int probe_uart401(struct address_info *hw_config, struct module *owner)
392394

393395
void unload_uart401(struct address_info *hw_config)
394396
{
395-
uart401_devc *devc;
397+
struct uart401_devc *devc;
396398
int n=hw_config->slots[4];
397399

398400
/* Not set up */

0 commit comments

Comments
 (0)