From: Luis R. Rodriguez Date: Thu, 10 Dec 2009 18:20:55 +0000 (-0800) Subject: Update based on newer stuff on compat-wireless X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=34492988d48c39b3f35b6404e43669474ec92421;p=openwrt%2Fstaging%2Fblogic.git Update based on newer stuff on compat-wireless Sorry for the large change-in-one to on this commit but this won't happen often, this is just the final step to start making use of compat.ko on compat-wireless. Signed-off-by: Luis R. Rodriguez --- diff --git a/compat-2.6.28.c b/compat-2.6.28.c index 4b3ea21a25ae..a8dfcbb9f038 100644 --- a/compat-2.6.28.c +++ b/compat-2.6.28.c @@ -84,6 +84,81 @@ void usb_poison_urb(struct urb *urb) EXPORT_SYMBOL_GPL(usb_poison_urb); #endif +#include +struct pcmcia_cfg_mem { + tuple_t tuple; + cisparse_t parse; + u8 buf[256]; + cistpl_cftable_entry_t dflt; +}; +/** + * pcmcia_loop_config() - loop over configuration options + * @p_dev: the struct pcmcia_device which we need to loop for. + * @conf_check: function to call for each configuration option. + * It gets passed the struct pcmcia_device, the CIS data + * describing the configuration option, and private data + * being passed to pcmcia_loop_config() + * @priv_data: private data to be passed to the conf_check function. + * + * pcmcia_loop_config() loops over all configuration options, and calls + * the driver-specific conf_check() for each one, checking whether + * it is a valid one. Returns 0 on success or errorcode otherwise. + */ +int pcmcia_loop_config(struct pcmcia_device *p_dev, + int (*conf_check) (struct pcmcia_device *p_dev, + cistpl_cftable_entry_t *cfg, + cistpl_cftable_entry_t *dflt, + unsigned int vcc, + void *priv_data), + void *priv_data) +{ + struct pcmcia_cfg_mem *cfg_mem; + + tuple_t *tuple; + int ret; + unsigned int vcc; + + cfg_mem = kzalloc(sizeof(struct pcmcia_cfg_mem), GFP_KERNEL); + if (cfg_mem == NULL) + return -ENOMEM; + + /* get the current Vcc setting */ + vcc = p_dev->socket->socket.Vcc; + + tuple = &cfg_mem->tuple; + tuple->TupleData = cfg_mem->buf; + tuple->TupleDataMax = 255; + tuple->TupleOffset = 0; + tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY; + tuple->Attributes = 0; + + ret = pcmcia_get_first_tuple(p_dev, tuple); + while (!ret) { + cistpl_cftable_entry_t *cfg = &cfg_mem->parse.cftable_entry; + + if (pcmcia_get_tuple_data(p_dev, tuple)) + goto next_entry; + + if (pcmcia_parse_tuple(tuple, &cfg_mem->parse)) + goto next_entry; + + /* default values */ + p_dev->conf.ConfigIndex = cfg->index; + if (cfg->flags & CISTPL_CFTABLE_DEFAULT) + cfg_mem->dflt = *cfg; + + ret = conf_check(p_dev, cfg, &cfg_mem->dflt, vcc, priv_data); + if (!ret) + break; + +next_entry: + ret = pcmcia_get_next_tuple(p_dev, tuple); + } + + return ret; +} +EXPORT_SYMBOL(pcmcia_loop_config); + void usb_unpoison_urb(struct urb *urb) { #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) @@ -275,4 +350,14 @@ unsigned long round_jiffies_up(unsigned long j) } EXPORT_SYMBOL_GPL(round_jiffies_up); +void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off, + int size) +{ + skb_fill_page_desc(skb, i, page, off, size); + skb->len += size; + skb->data_len += size; + skb->truesize += size; +} +EXPORT_SYMBOL(skb_add_rx_frag); + #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) */ diff --git a/compat-2.6.28.h b/compat-2.6.28.h index 69ddae6aafce..8f90edc6d9bf 100644 --- a/compat-2.6.28.h +++ b/compat-2.6.28.h @@ -36,6 +36,16 @@ #define pcmcia_parse_tuple(tuple, parse) pccard_parse_tuple(tuple, parse) #endif +/* From : include/pcmcia/ds.h */ +/* loop CIS entries for valid configuration */ +int pcmcia_loop_config(struct pcmcia_device *p_dev, + int (*conf_check) (struct pcmcia_device *p_dev, + cistpl_cftable_entry_t *cfg, + cistpl_cftable_entry_t *dflt, + unsigned int vcc, + void *priv_data), + void *priv_data); + #if 0 extern void usb_poison_urb(struct urb *urb); #endif @@ -145,6 +155,20 @@ static inline void skb_queue_splice_tail_init(struct sk_buff_head *list, } } /* From include/linux/skbuff.h */ +/** + * skb_queue_splice_tail - join two skb lists, each list being a queue + * @list: the new list to add + * @head: the place to add it in the first list + */ +static inline void skb_queue_splice_tail(const struct sk_buff_head *list, + struct sk_buff_head *head) +{ + if (!skb_queue_empty(list)) { + __skb_queue_splice(list, head->prev, (struct sk_buff *) head); + head->qlen += list->qlen; + } +} + #ifndef DECLARE_TRACE #define TP_PROTO(args...) args @@ -177,6 +201,9 @@ static inline void skb_queue_splice_tail_init(struct sk_buff_head *list, unsigned long round_jiffies_up(unsigned long j); +extern void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, + int off, int size); + #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)) */ #endif /* LINUX_26_28_COMPAT_H */ diff --git a/compat-2.6.30.h b/compat-2.6.30.h index fe3233c2224c..2ff1d6917e56 100644 --- a/compat-2.6.30.h +++ b/compat-2.6.30.h @@ -15,6 +15,15 @@ #define IRQ_WAKE_THREAD (2) +/* From : include/linux/pm.h */ +/* How to reorder dpm_list after device_move() */ +enum dpm_order { + DPM_ORDER_NONE, + DPM_ORDER_DEV_AFTER_PARENT, + DPM_ORDER_PARENT_BEFORE_DEV, + DPM_ORDER_DEV_LAST, +}; + #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)) */ #endif /* LINUX_26_30_COMPAT_H */ diff --git a/compat-2.6.31.h b/compat-2.6.31.h index 6b2dd5efed82..27dc6a1dbe45 100644 --- a/compat-2.6.31.h +++ b/compat-2.6.31.h @@ -11,6 +11,7 @@ #include #include #include +#include /* * These macros allow us to backport rfkill without any @@ -106,7 +107,7 @@ static inline struct dst_entry *skb_dst(const struct sk_buff *skb) static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst) { - skb->dst = (unsigned long)dst; + skb->dst = dst; } static inline struct rtable *skb_rtable(const struct sk_buff *skb) diff --git a/compat-2.6.32.h b/compat-2.6.32.h index cef18998c1da..3e8725a18fd8 100644 --- a/compat-2.6.32.h +++ b/compat-2.6.32.h @@ -43,8 +43,34 @@ enum netdev_tx { typedef enum netdev_tx netdev_tx_t; #endif /* __KERNEL__ */ +/* + * dev_pm_ops is only available on kernels >= 2.6.29, for + * older kernels we rely on reverting the work to old + * power management style stuff. + */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) +/* + * Use this if you want to use the same suspend and resume callbacks for suspend + * to RAM and hibernation. + */ +#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ +struct dev_pm_ops name = { \ + .suspend = suspend_fn, \ + .resume = resume_fn, \ + .freeze = suspend_fn, \ + .thaw = resume_fn, \ + .poweroff = suspend_fn, \ + .restore = resume_fn, \ +} +#else +#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) +#endif /* >= 2.6.29 */ + #define wireless_send_event(a, b, c, d) wireless_send_event(a, b, c, (char * ) d) +/* The export symbol in changed in compat/patches/15-symbol-export-conflicts.patch */ +#define ieee80211_rx(hw, skb) mac80211_ieee80211_rx(hw, skb) + #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)) */ #endif /* LINUX_26_32_COMPAT_H */