Skip to content

Commit

Permalink
net: Remove casts of void *
Browse files Browse the repository at this point in the history
Unnecessary casts of void * clutter the code.

These are the remainder casts after several specific
patches to remove netdev_priv and dev_priv.

Done via coccinelle script:

$ cat cast_void_pointer.cocci
@@
type T;
T *pt;
void *pv;
@@

- pt = (T *)pv;
+ pt = pv;

Signed-off-by: Joe Perches <[email protected]>
Acked-by: Paul Moore <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
JoePerches authored and David S. Miller committed Jun 17, 2011
1 parent 3c8def9 commit ea11073
Show file tree
Hide file tree
Showing 21 changed files with 74 additions and 83 deletions.
2 changes: 1 addition & 1 deletion net/8021q/vlanproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ static void *vlan_seq_next(struct seq_file *seq, void *v, loff_t *pos)

++*pos;

dev = (struct net_device *)v;
dev = v;
if (v == SEQ_START_TOKEN)
dev = net_device_entry(&net->dev_base_head);

Expand Down
2 changes: 1 addition & 1 deletion net/atm/mpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ static int mpoa_event_listener(struct notifier_block *mpoa_notifier,
struct mpoa_client *mpc;
struct lec_priv *priv;

dev = (struct net_device *)dev_ptr;
dev = dev_ptr;

if (!net_eq(dev_net(dev), &init_net))
return NOTIFY_DONE;
Expand Down
2 changes: 1 addition & 1 deletion net/ceph/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ int ceph_key_instantiate(struct key *key, const void *data, size_t datalen)
goto err;

/* TODO ceph_crypto_key_decode should really take const input */
p = (void*)data;
p = (void *)data;
ret = ceph_crypto_key_decode(ckey, &p, (char*)data+datalen);
if (ret < 0)
goto err_ckey;
Expand Down
2 changes: 1 addition & 1 deletion net/decnet/dn_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,7 @@ static void *dn_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos)

++*pos;

dev = (struct net_device *)v;
dev = v;
if (v == SEQ_START_TOKEN)
dev = net_device_entry(&init_net.dev_base_head);

Expand Down
4 changes: 2 additions & 2 deletions net/irda/af_irda.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ static void irda_getvalue_confirm(int result, __u16 obj_id,
{
struct irda_sock *self;

self = (struct irda_sock *) priv;
self = priv;
if (!self) {
IRDA_WARNING("%s: lost myself!\n", __func__);
return;
Expand Down Expand Up @@ -418,7 +418,7 @@ static void irda_selective_discovery_indication(discinfo_t *discovery,

IRDA_DEBUG(2, "%s()\n", __func__);

self = (struct irda_sock *) priv;
self = priv;
if (!self) {
IRDA_WARNING("%s: lost myself!\n", __func__);
return;
Expand Down
2 changes: 1 addition & 1 deletion net/irda/ircomm/ircomm_tty_attach.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ static void ircomm_tty_discovery_indication(discinfo_t *discovery,
info.daddr = discovery->daddr;
info.saddr = discovery->saddr;

self = (struct ircomm_tty_cb *) priv;
self = priv;
ircomm_tty_do_event(self, IRCOMM_TTY_DISCOVERY_INDICATION,
NULL, &info);
}
Expand Down
2 changes: 1 addition & 1 deletion net/irda/irda_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ static void irda_task_timer_expired(void *data)

IRDA_DEBUG(2, "%s()\n", __func__);

task = (struct irda_task *) data;
task = data;

irda_task_kick(task);
}
Expand Down
8 changes: 4 additions & 4 deletions net/irda/iriap.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ static void iriap_disconnect_indication(void *instance, void *sap,

IRDA_DEBUG(4, "%s(), reason=%s\n", __func__, irlmp_reasons[reason]);

self = (struct iriap_cb *) instance;
self = instance;

IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IAS_MAGIC, return;);
Expand Down Expand Up @@ -754,7 +754,7 @@ static void iriap_connect_confirm(void *instance, void *sap,
{
struct iriap_cb *self;

self = (struct iriap_cb *) instance;
self = instance;

IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IAS_MAGIC, return;);
Expand Down Expand Up @@ -786,7 +786,7 @@ static void iriap_connect_indication(void *instance, void *sap,

IRDA_DEBUG(1, "%s()\n", __func__);

self = (struct iriap_cb *) instance;
self = instance;

IRDA_ASSERT(skb != NULL, return;);
IRDA_ASSERT(self != NULL, goto out;);
Expand Down Expand Up @@ -834,7 +834,7 @@ static int iriap_data_indication(void *instance, void *sap,

IRDA_DEBUG(3, "%s()\n", __func__);

self = (struct iriap_cb *) instance;
self = instance;

IRDA_ASSERT(skb != NULL, return 0;);
IRDA_ASSERT(self != NULL, goto out;);
Expand Down
10 changes: 5 additions & 5 deletions net/irda/irlan/irlan_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ static int irlan_client_ctrl_data_indication(void *instance, void *sap,

IRDA_DEBUG(2, "%s()\n", __func__ );

self = (struct irlan_cb *) instance;
self = instance;

IRDA_ASSERT(self != NULL, return -1;);
IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;);
Expand Down Expand Up @@ -226,8 +226,8 @@ static void irlan_client_ctrl_disconnect_indication(void *instance, void *sap,

IRDA_DEBUG(4, "%s(), reason=%d\n", __func__ , reason);

self = (struct irlan_cb *) instance;
tsap = (struct tsap_cb *) sap;
self = instance;
tsap = sap;

IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
Expand Down Expand Up @@ -298,7 +298,7 @@ static void irlan_client_ctrl_connect_confirm(void *instance, void *sap,

IRDA_DEBUG(4, "%s()\n", __func__ );

self = (struct irlan_cb *) instance;
self = instance;

IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
Expand Down Expand Up @@ -542,7 +542,7 @@ void irlan_client_get_value_confirm(int result, __u16 obj_id,

IRDA_ASSERT(priv != NULL, return;);

self = (struct irlan_cb *) priv;
self = priv;
IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);

/* We probably don't need to make any more queries */
Expand Down
10 changes: 5 additions & 5 deletions net/irda/irlan/irlan_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ static void irlan_connect_indication(void *instance, void *sap,

IRDA_DEBUG(2, "%s()\n", __func__ );

self = (struct irlan_cb *) instance;
tsap = (struct tsap_cb *) sap;
self = instance;
tsap = sap;

IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
Expand Down Expand Up @@ -361,7 +361,7 @@ static void irlan_connect_confirm(void *instance, void *sap,
{
struct irlan_cb *self;

self = (struct irlan_cb *) instance;
self = instance;

IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
Expand Down Expand Up @@ -406,8 +406,8 @@ static void irlan_disconnect_indication(void *instance,

IRDA_DEBUG(0, "%s(), reason=%d\n", __func__ , reason);

self = (struct irlan_cb *) instance;
tsap = (struct tsap_cb *) sap;
self = instance;
tsap = sap;

IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
Expand Down
2 changes: 1 addition & 1 deletion net/irda/irlan/irlan_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ void irlan_eth_flow_indication(void *instance, void *sap, LOCAL_FLOW flow)
struct irlan_cb *self;
struct net_device *dev;

self = (struct irlan_cb *) instance;
self = instance;

IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
Expand Down
10 changes: 5 additions & 5 deletions net/irda/irlan/irlan_provider.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static int irlan_provider_data_indication(void *instance, void *sap,

IRDA_DEBUG(4, "%s()\n", __func__ );

self = (struct irlan_cb *) instance;
self = instance;

IRDA_ASSERT(self != NULL, return -1;);
IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;);
Expand Down Expand Up @@ -131,8 +131,8 @@ static void irlan_provider_connect_indication(void *instance, void *sap,

IRDA_DEBUG(0, "%s()\n", __func__ );

self = (struct irlan_cb *) instance;
tsap = (struct tsap_cb *) sap;
self = instance;
tsap = sap;

IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
Expand Down Expand Up @@ -182,8 +182,8 @@ static void irlan_provider_disconnect_indication(void *instance, void *sap,

IRDA_DEBUG(4, "%s(), reason=%d\n", __func__ , reason);

self = (struct irlan_cb *) instance;
tsap = (struct tsap_cb *) sap;
self = instance;
tsap = sap;

IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
Expand Down
4 changes: 2 additions & 2 deletions net/irda/irqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ void* hashbin_lock_find( hashbin_t* hashbin, long hashv, const char* name )
/*
* Search for entry
*/
entry = (irda_queue_t* ) hashbin_find( hashbin, hashv, name );
entry = hashbin_find(hashbin, hashv, name);

/* Release lock */
spin_unlock_irqrestore(&hashbin->hb_spinlock, flags);
Expand Down Expand Up @@ -813,7 +813,7 @@ void* hashbin_find_next( hashbin_t* hashbin, long hashv, const char* name,
* This allow to check if the current item is still in the
* hashbin or has been removed.
*/
entry = (irda_queue_t* ) hashbin_find( hashbin, hashv, name );
entry = hashbin_find(hashbin, hashv, name);

/*
* Trick hashbin_get_next() to return what we want
Expand Down
18 changes: 9 additions & 9 deletions net/irda/irttp.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ static int irttp_param_max_sdu_size(void *instance, irda_param_t *param,
{
struct tsap_cb *self;

self = (struct tsap_cb *) instance;
self = instance;

IRDA_ASSERT(self != NULL, return -1;);
IRDA_ASSERT(self->magic == TTP_TSAP_MAGIC, return -1;);
Expand Down Expand Up @@ -879,7 +879,7 @@ static int irttp_udata_indication(void *instance, void *sap,

IRDA_DEBUG(4, "%s()\n", __func__);

self = (struct tsap_cb *) instance;
self = instance;

IRDA_ASSERT(self != NULL, return -1;);
IRDA_ASSERT(self->magic == TTP_TSAP_MAGIC, return -1;);
Expand Down Expand Up @@ -914,7 +914,7 @@ static int irttp_data_indication(void *instance, void *sap,
unsigned long flags;
int n;

self = (struct tsap_cb *) instance;
self = instance;

n = skb->data[0] & 0x7f; /* Extract the credits */

Expand Down Expand Up @@ -996,7 +996,7 @@ static void irttp_status_indication(void *instance,

IRDA_DEBUG(4, "%s()\n", __func__);

self = (struct tsap_cb *) instance;
self = instance;

IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == TTP_TSAP_MAGIC, return;);
Expand Down Expand Up @@ -1025,7 +1025,7 @@ static void irttp_flow_indication(void *instance, void *sap, LOCAL_FLOW flow)
{
struct tsap_cb *self;

self = (struct tsap_cb *) instance;
self = instance;

IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == TTP_TSAP_MAGIC, return;);
Expand Down Expand Up @@ -1208,7 +1208,7 @@ static void irttp_connect_confirm(void *instance, void *sap,

IRDA_DEBUG(4, "%s()\n", __func__);

self = (struct tsap_cb *) instance;
self = instance;

IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == TTP_TSAP_MAGIC, return;);
Expand Down Expand Up @@ -1292,13 +1292,13 @@ static void irttp_connect_indication(void *instance, void *sap,
__u8 plen;
__u8 n;

self = (struct tsap_cb *) instance;
self = instance;

IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == TTP_TSAP_MAGIC, return;);
IRDA_ASSERT(skb != NULL, return;);

lsap = (struct lsap_cb *) sap;
lsap = sap;

self->max_seg_size = max_seg_size - TTP_HEADER;
self->max_header_size = max_header_size+TTP_HEADER;
Expand Down Expand Up @@ -1602,7 +1602,7 @@ static void irttp_disconnect_indication(void *instance, void *sap,

IRDA_DEBUG(4, "%s()\n", __func__);

self = (struct tsap_cb *) instance;
self = instance;

IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == TTP_TSAP_MAGIC, return;);
Expand Down
Loading

0 comments on commit ea11073

Please sign in to comment.