diff options
| author | Stephen Hemminger <shemminger@osdl.org> | 2004-03-08 21:36:28 -0800 |
|---|---|---|
| committer | Stephen Hemminger <shemminger@osdl.org> | 2004-03-08 21:36:28 -0800 |
| commit | 520220ec6e8c00d48b2a06ba4a422e47f4e18d03 (patch) | |
| tree | 7de13ef45ca50f6da7dc49b248ee4ff3c1999eff | |
| parent | 1bf3d880daa8fe8503ef6a0a7f1dc3867f39b9a4 (diff) | |
[IRDA]: Make irda_get_mtt et al. inline and not defines for better type checking.
irda_device_setup can now be static, only called from alloc_irdadev.
| -rw-r--r-- | include/net/irda/irda_device.h | 62 | ||||
| -rw-r--r-- | net/irda/irda_device.c | 16 | ||||
| -rw-r--r-- | net/irda/irsyms.c | 12 |
3 files changed, 26 insertions, 64 deletions
diff --git a/include/net/irda/irda_device.h b/include/net/irda/irda_device.h index 6f4ce027c7ae..1d4cd8edc400 100644 --- a/include/net/irda/irda_device.h +++ b/include/net/irda/irda_device.h @@ -227,7 +227,6 @@ static inline int irda_device_txqueue_empty(const struct net_device *dev) int irda_device_set_raw_mode(struct net_device* self, int status); int irda_device_set_dtr_rts(struct net_device *dev, int dtr, int rts); int irda_device_change_speed(struct net_device *dev, __u32 speed); -void irda_device_setup(struct net_device *dev); struct net_device *alloc_irdadev(int sizeof_priv); /* Dongle interface */ @@ -253,28 +252,11 @@ void irda_task_next_state(struct irda_task *task, IRDA_TASK_STATE state); * Utility function for getting the minimum turnaround time out of * the skb, where it has been hidden in the cb field. */ -#define irda_get_mtt(skb) ( \ - IRDA_MIN(10000, \ - (((struct irda_skb_cb *) skb->cb)->magic == LAP_MAGIC) ? \ - ((struct irda_skb_cb *)(skb->cb))->mtt : 10000 \ - ) \ -) - -#if 0 -extern inline __u16 irda_get_mtt(struct sk_buff *skb) +static inline __u16 irda_get_mtt(const struct sk_buff *skb) { - __u16 mtt; - - if (((struct irda_skb_cb *)(skb->cb))->magic != LAP_MAGIC) - mtt = 10000; - else - mtt = ((struct irda_skb_cb *)(skb->cb))->mtt; - - ASSERT(mtt <= 10000, return 10000;); - - return mtt; + const struct irda_skb_cb *cb = (const struct irda_skb_cb *) skb->cb; + return (cb->magic == LAP_MAGIC) ? cb->mtt : 10000; } -#endif /* * Function irda_get_next_speed (skb) @@ -283,24 +265,11 @@ extern inline __u16 irda_get_mtt(struct sk_buff *skb) * * Note : return -1 for user space frames */ -#define irda_get_next_speed(skb) ( \ - (((struct irda_skb_cb*) skb->cb)->magic == LAP_MAGIC) ? \ - ((struct irda_skb_cb *)(skb->cb))->next_speed : -1 \ -) - -#if 0 -extern inline __u32 irda_get_next_speed(struct sk_buff *skb) +static inline __u32 irda_get_next_speed(const struct sk_buff *skb) { - __u32 speed; - - if (((struct irda_skb_cb *)(skb->cb))->magic != LAP_MAGIC) - speed = -1; - else - speed = ((struct irda_skb_cb *)(skb->cb))->next_speed; - - return speed; + const struct irda_skb_cb *cb = (const struct irda_skb_cb *) skb->cb; + return (cb->magic == LAP_MAGIC) ? cb->next_speed : -1; } -#endif /* * Function irda_get_next_xbofs (skb) @@ -309,10 +278,11 @@ extern inline __u32 irda_get_next_speed(struct sk_buff *skb) * * Note : default to 10 for user space frames */ -#define irda_get_xbofs(skb) ( \ - (((struct irda_skb_cb*) skb->cb)->magic == LAP_MAGIC) ? \ - ((struct irda_skb_cb *)(skb->cb))->xbofs : 10 \ -) +static inline __u16 irda_get_xbofs(const struct sk_buff *skb) +{ + const struct irda_skb_cb *cb = (const struct irda_skb_cb *) skb->cb; + return (cb->magic == LAP_MAGIC) ? cb->xbofs : 10; +} /* * Function irda_get_next_xbofs (skb) @@ -321,11 +291,11 @@ extern inline __u32 irda_get_next_speed(struct sk_buff *skb) * * Note : return -1 for user space frames */ -#define irda_get_next_xbofs(skb) ( \ - (((struct irda_skb_cb*) skb->cb)->magic == LAP_MAGIC) ? \ - ((struct irda_skb_cb *)(skb->cb))->next_xbofs : -1 \ -) - +static inline __u16 irda_get_next_xbofs(const struct sk_buff *skb) +{ + const struct irda_skb_cb *cb = (const struct irda_skb_cb *) skb->cb; + return (cb->magic == LAP_MAGIC) ? cb->next_xbofs : -1; +} #endif /* IRDA_DEVICE_H */ diff --git a/net/irda/irda_device.c b/net/irda/irda_device.c index 38a9d5562da7..a0b321ad3b53 100644 --- a/net/irda/irda_device.c +++ b/net/irda/irda_device.c @@ -140,6 +140,8 @@ void irda_device_set_media_busy(struct net_device *dev, int status) irlap_stop_mbusy_timer(self); } } +EXPORT_SYMBOL(irda_device_set_media_busy); + int irda_device_set_dtr_rts(struct net_device *dev, int dtr, int rts) { @@ -214,6 +216,7 @@ void irda_task_next_state(struct irda_task *task, IRDA_TASK_STATE state) task->state = state; } +EXPORT_SYMBOL(irda_task_next_state); static void __irda_task_delete(struct irda_task *task) { @@ -320,7 +323,6 @@ struct irda_task *irda_task_execute(void *instance, struct irda_task *parent, void *param) { struct irda_task *task; - int ret; IRDA_DEBUG(2, "%s()\n", __FUNCTION__); @@ -342,12 +344,9 @@ struct irda_task *irda_task_execute(void *instance, hashbin_insert(tasks, (irda_queue_t *) task, (long) task, NULL); /* No time to waste, so lets get going! */ - ret = irda_task_kick(task); - if (ret) - return NULL; - else - return task; + return irda_task_kick(task) ? NULL : task; } +EXPORT_SYMBOL(irda_task_execute); /* * Function irda_task_timer_expired (data) @@ -395,6 +394,7 @@ struct net_device *alloc_irdadev(int sizeof_priv) { return alloc_netdev(sizeof_priv, "irda%d", irda_device_setup); } +EXPORT_SYMBOL(alloc_irdadev); /* * Function irda_device_init_dongle (self, type, qos) @@ -446,6 +446,7 @@ dongle_t *irda_device_dongle_init(struct net_device *dev, int type) spin_unlock(&dongles->hb_spinlock); return dongle; } +EXPORT_SYMBOL(irda_device_dongle_init); /* * Function irda_device_dongle_cleanup (dongle) @@ -460,6 +461,7 @@ int irda_device_dongle_cleanup(dongle_t *dongle) return 0; } +EXPORT_SYMBOL(irda_device_dongle_cleanup); /* * Function irda_device_register_dongle (dongle) @@ -479,6 +481,7 @@ int irda_device_register_dongle(struct dongle_reg *new) return 0; } +EXPORT_SYMBOL(irda_device_register_dongle); /* * Function irda_device_unregister_dongle (dongle) @@ -496,6 +499,7 @@ void irda_device_unregister_dongle(struct dongle_reg *dongle) ERROR("%s: dongle not found!\n", __FUNCTION__); spin_unlock(&dongles->hb_spinlock); } +EXPORT_SYMBOL(irda_device_unregister_dongle); /* * Function irda_device_set_mode (self, mode) diff --git a/net/irda/irsyms.c b/net/irda/irsyms.c index 3bbe65bd641b..30b5552650cd 100644 --- a/net/irda/irsyms.c +++ b/net/irda/irsyms.c @@ -82,18 +82,6 @@ EXPORT_SYMBOL(irda_param_unpack); /* IrLAP */ EXPORT_SYMBOL(irda_init_max_qos_capabilies); EXPORT_SYMBOL(irda_qos_bits_to_value); -EXPORT_SYMBOL(irda_device_setup); -EXPORT_SYMBOL(alloc_irdadev); -EXPORT_SYMBOL(irda_device_set_media_busy); -EXPORT_SYMBOL(irda_device_txqueue_empty); - -EXPORT_SYMBOL(irda_device_dongle_init); -EXPORT_SYMBOL(irda_device_dongle_cleanup); -EXPORT_SYMBOL(irda_device_register_dongle); -EXPORT_SYMBOL(irda_device_unregister_dongle); -EXPORT_SYMBOL(irda_task_execute); -EXPORT_SYMBOL(irda_task_next_state); -EXPORT_SYMBOL(irda_task_delete); #ifdef CONFIG_IRDA_DEBUG |
