Commit 520220ec authored by Stephen Hemminger's avatar Stephen Hemminger

[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.
parent 1bf3d880
...@@ -227,7 +227,6 @@ static inline int irda_device_txqueue_empty(const struct net_device *dev) ...@@ -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_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_set_dtr_rts(struct net_device *dev, int dtr, int rts);
int irda_device_change_speed(struct net_device *dev, __u32 speed); 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); struct net_device *alloc_irdadev(int sizeof_priv);
/* Dongle interface */ /* Dongle interface */
...@@ -253,28 +252,11 @@ void irda_task_next_state(struct irda_task *task, IRDA_TASK_STATE state); ...@@ -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 * Utility function for getting the minimum turnaround time out of
* the skb, where it has been hidden in the cb field. * the skb, where it has been hidden in the cb field.
*/ */
#define irda_get_mtt(skb) ( \ static inline __u16 irda_get_mtt(const struct sk_buff *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)
{ {
__u16 mtt; const struct irda_skb_cb *cb = (const struct irda_skb_cb *) skb->cb;
return (cb->magic == LAP_MAGIC) ? cb->mtt : 10000;
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;
} }
#endif
/* /*
* Function irda_get_next_speed (skb) * Function irda_get_next_speed (skb)
...@@ -283,24 +265,11 @@ extern inline __u16 irda_get_mtt(struct sk_buff *skb) ...@@ -283,24 +265,11 @@ extern inline __u16 irda_get_mtt(struct sk_buff *skb)
* *
* Note : return -1 for user space frames * Note : return -1 for user space frames
*/ */
#define irda_get_next_speed(skb) ( \ static inline __u32 irda_get_next_speed(const struct sk_buff *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)
{ {
__u32 speed; const struct irda_skb_cb *cb = (const struct irda_skb_cb *) skb->cb;
return (cb->magic == LAP_MAGIC) ? cb->next_speed : -1;
if (((struct irda_skb_cb *)(skb->cb))->magic != LAP_MAGIC)
speed = -1;
else
speed = ((struct irda_skb_cb *)(skb->cb))->next_speed;
return speed;
} }
#endif
/* /*
* Function irda_get_next_xbofs (skb) * Function irda_get_next_xbofs (skb)
...@@ -309,10 +278,11 @@ extern inline __u32 irda_get_next_speed(struct sk_buff *skb) ...@@ -309,10 +278,11 @@ extern inline __u32 irda_get_next_speed(struct sk_buff *skb)
* *
* Note : default to 10 for user space frames * Note : default to 10 for user space frames
*/ */
#define irda_get_xbofs(skb) ( \ static inline __u16 irda_get_xbofs(const struct sk_buff *skb)
(((struct irda_skb_cb*) skb->cb)->magic == LAP_MAGIC) ? \ {
((struct irda_skb_cb *)(skb->cb))->xbofs : 10 \ 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) * Function irda_get_next_xbofs (skb)
...@@ -321,11 +291,11 @@ extern inline __u32 irda_get_next_speed(struct sk_buff *skb) ...@@ -321,11 +291,11 @@ extern inline __u32 irda_get_next_speed(struct sk_buff *skb)
* *
* Note : return -1 for user space frames * Note : return -1 for user space frames
*/ */
#define irda_get_next_xbofs(skb) ( \ static inline __u16 irda_get_next_xbofs(const struct sk_buff *skb)
(((struct irda_skb_cb*) skb->cb)->magic == LAP_MAGIC) ? \ {
((struct irda_skb_cb *)(skb->cb))->next_xbofs : -1 \ 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 */ #endif /* IRDA_DEVICE_H */
...@@ -140,6 +140,8 @@ void irda_device_set_media_busy(struct net_device *dev, int status) ...@@ -140,6 +140,8 @@ void irda_device_set_media_busy(struct net_device *dev, int status)
irlap_stop_mbusy_timer(self); 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) 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) ...@@ -214,6 +216,7 @@ void irda_task_next_state(struct irda_task *task, IRDA_TASK_STATE state)
task->state = state; task->state = state;
} }
EXPORT_SYMBOL(irda_task_next_state);
static void __irda_task_delete(struct irda_task *task) static void __irda_task_delete(struct irda_task *task)
{ {
...@@ -320,7 +323,6 @@ struct irda_task *irda_task_execute(void *instance, ...@@ -320,7 +323,6 @@ struct irda_task *irda_task_execute(void *instance,
struct irda_task *parent, void *param) struct irda_task *parent, void *param)
{ {
struct irda_task *task; struct irda_task *task;
int ret;
IRDA_DEBUG(2, "%s()\n", __FUNCTION__); IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
...@@ -342,12 +344,9 @@ struct irda_task *irda_task_execute(void *instance, ...@@ -342,12 +344,9 @@ struct irda_task *irda_task_execute(void *instance,
hashbin_insert(tasks, (irda_queue_t *) task, (long) task, NULL); hashbin_insert(tasks, (irda_queue_t *) task, (long) task, NULL);
/* No time to waste, so lets get going! */ /* No time to waste, so lets get going! */
ret = irda_task_kick(task); return irda_task_kick(task) ? NULL : task;
if (ret)
return NULL;
else
return task;
} }
EXPORT_SYMBOL(irda_task_execute);
/* /*
* Function irda_task_timer_expired (data) * Function irda_task_timer_expired (data)
...@@ -395,6 +394,7 @@ struct net_device *alloc_irdadev(int sizeof_priv) ...@@ -395,6 +394,7 @@ struct net_device *alloc_irdadev(int sizeof_priv)
{ {
return alloc_netdev(sizeof_priv, "irda%d", irda_device_setup); return alloc_netdev(sizeof_priv, "irda%d", irda_device_setup);
} }
EXPORT_SYMBOL(alloc_irdadev);
/* /*
* Function irda_device_init_dongle (self, type, qos) * Function irda_device_init_dongle (self, type, qos)
...@@ -446,6 +446,7 @@ dongle_t *irda_device_dongle_init(struct net_device *dev, int type) ...@@ -446,6 +446,7 @@ dongle_t *irda_device_dongle_init(struct net_device *dev, int type)
spin_unlock(&dongles->hb_spinlock); spin_unlock(&dongles->hb_spinlock);
return dongle; return dongle;
} }
EXPORT_SYMBOL(irda_device_dongle_init);
/* /*
* Function irda_device_dongle_cleanup (dongle) * Function irda_device_dongle_cleanup (dongle)
...@@ -460,6 +461,7 @@ int irda_device_dongle_cleanup(dongle_t *dongle) ...@@ -460,6 +461,7 @@ int irda_device_dongle_cleanup(dongle_t *dongle)
return 0; return 0;
} }
EXPORT_SYMBOL(irda_device_dongle_cleanup);
/* /*
* Function irda_device_register_dongle (dongle) * Function irda_device_register_dongle (dongle)
...@@ -479,6 +481,7 @@ int irda_device_register_dongle(struct dongle_reg *new) ...@@ -479,6 +481,7 @@ int irda_device_register_dongle(struct dongle_reg *new)
return 0; return 0;
} }
EXPORT_SYMBOL(irda_device_register_dongle);
/* /*
* Function irda_device_unregister_dongle (dongle) * Function irda_device_unregister_dongle (dongle)
...@@ -496,6 +499,7 @@ void irda_device_unregister_dongle(struct dongle_reg *dongle) ...@@ -496,6 +499,7 @@ void irda_device_unregister_dongle(struct dongle_reg *dongle)
ERROR("%s: dongle not found!\n", __FUNCTION__); ERROR("%s: dongle not found!\n", __FUNCTION__);
spin_unlock(&dongles->hb_spinlock); spin_unlock(&dongles->hb_spinlock);
} }
EXPORT_SYMBOL(irda_device_unregister_dongle);
/* /*
* Function irda_device_set_mode (self, mode) * Function irda_device_set_mode (self, mode)
......
...@@ -82,18 +82,6 @@ EXPORT_SYMBOL(irda_param_unpack); ...@@ -82,18 +82,6 @@ EXPORT_SYMBOL(irda_param_unpack);
/* IrLAP */ /* IrLAP */
EXPORT_SYMBOL(irda_init_max_qos_capabilies); EXPORT_SYMBOL(irda_init_max_qos_capabilies);
EXPORT_SYMBOL(irda_qos_bits_to_value); 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 #ifdef CONFIG_IRDA_DEBUG
......
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