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 bb81ebcf512e6382e2048dc57fdd0714d6aa48af..3378d93cc33d8f71d37b1c9fbe8cf3d904cf0b84 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 f8ccd2cea3f930c5da2d01aa64f855c5bcd289c8..fe5fa267bc5bd2adfac3c1f2e90cd2d27f794add 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 68bc00a7458eec5ef39c1680bda7f1ca596690d5..9b390020fb52954ad090bc9e7a8eda66fa40df09 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);