b43: bus: abstract R/W operations
authorRafał Miłecki <zajec5@gmail.com>
Wed, 18 May 2011 00:06:37 +0000 (02:06 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 1 Jun 2011 19:10:56 +0000 (15:10 -0400)
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/b43/b43.h
drivers/net/wireless/b43/bus.c
drivers/net/wireless/b43/bus.h

index bb81ebc..3378d93 100644 (file)
@@ -883,34 +883,34 @@ static inline enum ieee80211_band b43_current_band(struct b43_wl *wl)
 
 static inline u16 b43_read16(struct b43_wldev *dev, u16 offset)
 {
-       return ssb_read16(dev->sdev, offset);
+       return dev->dev->read16(dev->dev, offset);
 }
 
 static inline void b43_write16(struct b43_wldev *dev, u16 offset, u16 value)
 {
-       ssb_write16(dev->sdev, offset, value);
+       dev->dev->write16(dev->dev, offset, value);
 }
 
 static inline u32 b43_read32(struct b43_wldev *dev, u16 offset)
 {
-       return ssb_read32(dev->sdev, offset);
+       return dev->dev->read32(dev->dev, offset);
 }
 
 static inline void b43_write32(struct b43_wldev *dev, u16 offset, u32 value)
 {
-       ssb_write32(dev->sdev, offset, value);
+       dev->dev->write32(dev->dev, offset, value);
 }
 
 static inline void b43_block_read(struct b43_wldev *dev, void *buffer,
                                 size_t count, u16 offset, u8 reg_width)
 {
-       ssb_block_read(dev->sdev, buffer, count, offset, reg_width);
+       dev->dev->block_read(dev->dev, buffer, count, offset, reg_width);
 }
 
 static inline void b43_block_write(struct b43_wldev *dev, const void *buffer,
                                   size_t count, u16 offset, u8 reg_width)
 {
-       ssb_block_write(dev->sdev, buffer, count, offset, reg_width);
+       dev->dev->block_write(dev->dev, buffer, count, offset, reg_width);
 }
 
 static inline bool b43_using_pio_transfers(struct b43_wldev *dev)
index f8ccd2c..fe5fa26 100644 (file)
 
 
 /* SSB */
+static inline u16 b43_bus_ssb_read16(struct b43_bus_dev *dev, u16 offset)
+{
+       return ssb_read16(dev->sdev, offset);
+}
+static inline u32 b43_bus_ssb_read32(struct b43_bus_dev *dev, u16 offset)
+{
+       return ssb_read32(dev->sdev, offset);
+}
+static inline
+void b43_bus_ssb_write16(struct b43_bus_dev *dev, u16 offset, u16 value)
+{
+       ssb_write16(dev->sdev, offset, value);
+}
+static inline
+void b43_bus_ssb_write32(struct b43_bus_dev *dev, u16 offset, u32 value)
+{
+       ssb_write32(dev->sdev, offset, value);
+}
+static inline
+void b43_bus_ssb_block_read(struct b43_bus_dev *dev, void *buffer,
+                           size_t count, u16 offset, u8 reg_width)
+{
+       ssb_block_read(dev->sdev, buffer, count, offset, reg_width);
+}
+static inline
+void b43_bus_ssb_block_write(struct b43_bus_dev *dev, const void *buffer,
+                            size_t count, u16 offset, u8 reg_width)
+{
+       ssb_block_write(dev->sdev, buffer, count, offset, reg_width);
+}
+
 struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev)
 {
        struct b43_bus_dev *dev = kzalloc(sizeof(*dev), GFP_KERNEL);
@@ -32,5 +63,12 @@ struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev)
        dev->bus_type = B43_BUS_SSB;
        dev->sdev = sdev;
 
+       dev->read16 = b43_bus_ssb_read16;
+       dev->read32 = b43_bus_ssb_read32;
+       dev->write16 = b43_bus_ssb_write16;
+       dev->write32 = b43_bus_ssb_write32;
+       dev->block_read = b43_bus_ssb_block_read;
+       dev->block_write = b43_bus_ssb_block_write;
+
        return dev;
 }
index 68bc00a..9b39002 100644 (file)
@@ -10,6 +10,15 @@ struct b43_bus_dev {
        union {
                struct ssb_device *sdev;
        };
+
+       u16 (*read16)(struct b43_bus_dev *dev, u16 offset);
+       u32 (*read32)(struct b43_bus_dev *dev, u16 offset);
+       void (*write16)(struct b43_bus_dev *dev, u16 offset, u16 value);
+       void (*write32)(struct b43_bus_dev *dev, u16 offset, u32 value);
+       void (*block_read)(struct b43_bus_dev *dev, void *buffer,
+                          size_t count, u16 offset, u8 reg_width);
+       void (*block_write)(struct b43_bus_dev *dev, const void *buffer,
+                           size_t count, u16 offset, u8 reg_width);
 };
 
 struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev);