brcm80211: fmac: use specific types in struct brcmf_bus
authorArend van Spriel <arend@broadcom.com>
Thu, 9 Feb 2012 20:09:02 +0000 (21:09 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 22 Feb 2012 19:48:51 +0000 (14:48 -0500)
The fields bus_priv and drvr are defined as void pointer. It is
preferred to have specific types for compiler type checking. To
prepare for other bus types the bus_priv field is defined as a
union containing the sdio bus private structure reference.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c
drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h
drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c

index b698a76..1d2b74d 100644 (file)
@@ -489,7 +489,7 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,
                sdiodev->func[0] = func->card->sdio_func[0];
                sdiodev->func[1] = func;
                sdiodev->bus_if = bus_if;
-               bus_if->bus_priv = sdiodev;
+               bus_if->bus_priv.sdio = sdiodev;
                bus_if->type = SDIO_BUS;
                bus_if->align = BRCMF_SDALIGN;
                dev_set_drvdata(&func->card->dev, sdiodev);
@@ -530,7 +530,7 @@ static void brcmf_ops_sdio_remove(struct sdio_func *func)
 
        if (func->num == 2) {
                bus_if = dev_get_drvdata(&func->dev);
-               sdiodev = bus_if->bus_priv;
+               sdiodev = bus_if->bus_priv.sdio;
                brcmf_dbg(TRACE, "F2 found, calling brcmf_sdio_remove...\n");
                brcmf_sdio_remove(sdiodev);
                dev_set_drvdata(&func->card->dev, NULL);
index ad9be24..567a966 100644 (file)
@@ -39,8 +39,11 @@ struct dngl_stats {
 /* interface structure between common and bus layer */
 struct brcmf_bus {
        u8 type;                /* bus type */
-       void *bus_priv;         /* pointer to bus private structure */
-       void *drvr;             /* pointer to driver pub structure brcmf_pub */
+       union {
+               /* pointer to sdio private structure */
+               struct brcmf_sdio_dev *sdio;
+       } bus_priv;
+       struct brcmf_pub *drvr; /* pointer to driver pub structure brcmf_pub */
        enum brcmf_bus_state state;
        uint maxctl;            /* Max size rxctl request from proto to bus */
        bool drvr_up;           /* Status flag of driver up/down */
index 6e4b5e8..b20029e 100644 (file)
@@ -2277,7 +2277,7 @@ static void brcmf_sdbrcm_bus_stop(struct device *dev)
        uint retries;
        int err;
        struct brcmf_bus *bus_if = dev_get_drvdata(dev);
-       struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv;
+       struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
        struct brcmf_sdio *bus = sdiodev->bus;
 
        brcmf_dbg(TRACE, "Enter\n");
@@ -2627,7 +2627,7 @@ static int brcmf_sdbrcm_bus_txdata(struct device *dev, struct sk_buff *pkt)
        int ret = -EBADE;
        uint datalen, prec;
        struct brcmf_bus *bus_if = dev_get_drvdata(dev);
-       struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv;
+       struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
        struct brcmf_sdio *bus = sdiodev->bus;
 
        brcmf_dbg(TRACE, "Enter\n");
@@ -2869,7 +2869,7 @@ brcmf_sdbrcm_bus_txctl(struct device *dev, unsigned char *msg, uint msglen)
        u8 doff = 0;
        int ret = -1;
        struct brcmf_bus *bus_if = dev_get_drvdata(dev);
-       struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv;
+       struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
        struct brcmf_sdio *bus = sdiodev->bus;
 
        brcmf_dbg(TRACE, "Enter\n");
@@ -2978,7 +2978,7 @@ brcmf_sdbrcm_bus_rxctl(struct device *dev, unsigned char *msg, uint msglen)
        uint rxlen = 0;
        bool pending;
        struct brcmf_bus *bus_if = dev_get_drvdata(dev);
-       struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv;
+       struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
        struct brcmf_sdio *bus = sdiodev->bus;
 
        brcmf_dbg(TRACE, "Enter\n");
@@ -3389,7 +3389,7 @@ brcmf_sdbrcm_download_firmware(struct brcmf_sdio *bus)
 static int brcmf_sdbrcm_bus_init(struct device *dev)
 {
        struct brcmf_bus *bus_if = dev_get_drvdata(dev);
-       struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv;
+       struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
        struct brcmf_sdio *bus = sdiodev->bus;
        unsigned long timeout;
        uint retries = 0;