提交 c1d35dfa 编写于 作者: I Ivo van Doorn 提交者: John W. Linville

rt2x00: Fix sparse warning on nested container_of()

Sparse produces warnings about nested contain_of() statements,
this means that lines like:
	interface_to_usbdev(to_usb_interface(rt2x00dev->dev));
will upset sparse.
Add a new macro to rt2x00usb.h which will convert to device
structure to the usb_device pointer in 2 steps to prevent this
sparse warning.
Signed-off-by: NIvo van Doorn <IvDoorn@gmail.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 d74f5ba4
...@@ -1672,8 +1672,7 @@ static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev) ...@@ -1672,8 +1672,7 @@ static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev)
static int rt2500usb_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) static int rt2500usb_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
{ {
struct rt2x00_dev *rt2x00dev = hw->priv; struct rt2x00_dev *rt2x00dev = hw->priv;
struct usb_device *usb_dev = struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev);
interface_to_usbdev(to_usb_interface(rt2x00dev->dev));
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
struct rt2x00_intf *intf = vif_to_intf(tx_info->control.vif); struct rt2x00_intf *intf = vif_to_intf(tx_info->control.vif);
struct queue_entry_priv_usb_bcn *bcn_priv; struct queue_entry_priv_usb_bcn *bcn_priv;
......
...@@ -40,8 +40,7 @@ int rt2x00usb_vendor_request(struct rt2x00_dev *rt2x00dev, ...@@ -40,8 +40,7 @@ int rt2x00usb_vendor_request(struct rt2x00_dev *rt2x00dev,
void *buffer, const u16 buffer_length, void *buffer, const u16 buffer_length,
const int timeout) const int timeout)
{ {
struct usb_device *usb_dev = struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev);
interface_to_usbdev(to_usb_interface(rt2x00dev->dev));
int status; int status;
unsigned int i; unsigned int i;
unsigned int pipe = unsigned int pipe =
...@@ -162,8 +161,7 @@ static void rt2x00usb_interrupt_txdone(struct urb *urb) ...@@ -162,8 +161,7 @@ static void rt2x00usb_interrupt_txdone(struct urb *urb)
int rt2x00usb_write_tx_data(struct queue_entry *entry) int rt2x00usb_write_tx_data(struct queue_entry *entry)
{ {
struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
struct usb_device *usb_dev = struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev);
interface_to_usbdev(to_usb_interface(rt2x00dev->dev));
struct queue_entry_priv_usb *entry_priv = entry->priv_data; struct queue_entry_priv_usb *entry_priv = entry->priv_data;
struct skb_frame_desc *skbdesc; struct skb_frame_desc *skbdesc;
u32 length; u32 length;
...@@ -319,8 +317,7 @@ EXPORT_SYMBOL_GPL(rt2x00usb_disable_radio); ...@@ -319,8 +317,7 @@ EXPORT_SYMBOL_GPL(rt2x00usb_disable_radio);
void rt2x00usb_init_rxentry(struct rt2x00_dev *rt2x00dev, void rt2x00usb_init_rxentry(struct rt2x00_dev *rt2x00dev,
struct queue_entry *entry) struct queue_entry *entry)
{ {
struct usb_device *usb_dev = struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev);
interface_to_usbdev(to_usb_interface(rt2x00dev->dev));
struct queue_entry_priv_usb *entry_priv = entry->priv_data; struct queue_entry_priv_usb *entry_priv = entry->priv_data;
usb_fill_bulk_urb(entry_priv->urb, usb_dev, usb_fill_bulk_urb(entry_priv->urb, usb_dev,
......
...@@ -26,6 +26,12 @@ ...@@ -26,6 +26,12 @@
#ifndef RT2X00USB_H #ifndef RT2X00USB_H
#define RT2X00USB_H #define RT2X00USB_H
#define to_usb_device_intf(d) \
({ \
struct usb_interface *intf = to_usb_interface(d); \
interface_to_usbdev(intf); \
})
/* /*
* This variable should be used with the * This variable should be used with the
* usb_driver structure initialization. * usb_driver structure initialization.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册