Skip to content

Commit

Permalink
pcmcia: Remove typedef in structs and emum
Browse files Browse the repository at this point in the history
The Linux kernel coding style guidelines suggest not using typedefs
for structure and enum types. This patch gets rid of the typedefs for
cirrus_state_t, vg46x_state_t and pcic_id. Also, the names of the structs
are changed to drop the _t, to make the name look less typedef-like.

The following Coccinelle semantic patch detects the cases for struct type:

@tn@
identifier i;
type td;
@@

-typedef
 struct i { ... }
-td
 ;

@@
type tn.td;
identifier tn.i;
@@

-td
+ struct i

[linux@dominikbrodowski.net: fix patch to apply cleanly after e632cd9
 was applied first]
Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
  • Loading branch information
Himangi Saraogi authored and Dominik Brodowski committed May 30, 2015
1 parent 820dc84 commit 8b0eb83
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions drivers/pcmcia/i82365.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,14 @@ module_param(recov_time, int, 0444);

/*====================================================================*/

typedef struct cirrus_state_t {
struct cirrus_state {
u_char misc1, misc2;
u_char timer[6];
} cirrus_state_t;
};

typedef struct vg46x_state_t {
struct vg46x_state {
u_char ctl, ema;
} vg46x_state_t;
};

struct i82365_socket {
u_short type, flags;
Expand All @@ -149,8 +149,8 @@ struct i82365_socket {
u_short psock;
u_char cs_irq, intr;
union {
cirrus_state_t cirrus;
vg46x_state_t vg46x;
struct cirrus_state cirrus;
struct vg46x_state vg46x;
} state;
};

Expand All @@ -173,11 +173,11 @@ static struct timer_list poll_timer;
/*====================================================================*/

/* These definitions must match the pcic table! */
typedef enum pcic_id {
enum pcic_id {
IS_I82365A, IS_I82365B, IS_I82365DF,
IS_IBM, IS_RF5Cx96, IS_VLSI, IS_VG468, IS_VG469,
IS_PD6710, IS_PD672X, IS_VT83C469,
} pcic_id;
};

/* Flags for classifying groups of controllers */
#define IS_VADEM 0x0001
Expand All @@ -189,12 +189,12 @@ typedef enum pcic_id {
#define IS_REGISTERED 0x2000
#define IS_ALIVE 0x8000

typedef struct pcic_t {
struct pcic {
char *name;
u_short flags;
} pcic_t;
};

static pcic_t pcic[] = {
static struct pcic pcic[] = {
{ "Intel i82365sl A step", 0 },
{ "Intel i82365sl B step", 0 },
{ "Intel i82365sl DF", IS_DF_PWR },
Expand Down Expand Up @@ -294,7 +294,7 @@ static void i365_set_pair(u_short sock, u_short reg, u_short data)
static void cirrus_get_state(u_short s)
{
int i;
cirrus_state_t *p = &socket[s].state.cirrus;
struct cirrus_state *p = &socket[s].state.cirrus;
p->misc1 = i365_get(s, PD67_MISC_CTL_1);
p->misc1 &= (PD67_MC1_MEDIA_ENA | PD67_MC1_INPACK_ENA);
p->misc2 = i365_get(s, PD67_MISC_CTL_2);
Expand All @@ -306,7 +306,7 @@ static void cirrus_set_state(u_short s)
{
int i;
u_char misc;
cirrus_state_t *p = &socket[s].state.cirrus;
struct cirrus_state *p = &socket[s].state.cirrus;

misc = i365_get(s, PD67_MISC_CTL_2);
i365_set(s, PD67_MISC_CTL_2, p->misc2);
Expand All @@ -321,7 +321,7 @@ static void cirrus_set_state(u_short s)
static u_int __init cirrus_set_opts(u_short s, char *buf)
{
struct i82365_socket *t = &socket[s];
cirrus_state_t *p = &socket[s].state.cirrus;
struct cirrus_state *p = &socket[s].state.cirrus;
u_int mask = 0xffff;

if (has_ring == -1) has_ring = 1;
Expand Down Expand Up @@ -377,23 +377,23 @@ static u_int __init cirrus_set_opts(u_short s, char *buf)

static void vg46x_get_state(u_short s)
{
vg46x_state_t *p = &socket[s].state.vg46x;
struct vg46x_state *p = &socket[s].state.vg46x;
p->ctl = i365_get(s, VG468_CTL);
if (socket[s].type == IS_VG469)
p->ema = i365_get(s, VG469_EXT_MODE);
}

static void vg46x_set_state(u_short s)
{
vg46x_state_t *p = &socket[s].state.vg46x;
struct vg46x_state *p = &socket[s].state.vg46x;
i365_set(s, VG468_CTL, p->ctl);
if (socket[s].type == IS_VG469)
i365_set(s, VG469_EXT_MODE, p->ema);
}

static u_int __init vg46x_set_opts(u_short s, char *buf)
{
vg46x_state_t *p = &socket[s].state.vg46x;
struct vg46x_state *p = &socket[s].state.vg46x;

flip(p->ctl, VG468_CTL_ASYNC, async_clock);
flip(p->ema, VG469_MODE_CABLE, cable_mode);
Expand Down

0 comments on commit 8b0eb83

Please sign in to comment.