2019-04-09 16:18:41

by Madhumitha Prabakaran

[permalink] [raw]
Subject: [PATCH] Staging: rtl8723bs: Remove typedef in struct sdio_data

Remove typedef in struct sdio_data and make the respective changes in
associated files, as the struct that has elements that can reasonably
be directly accessed should never be a typedef.

Signed-off-by: Madhumitha Prabakaran <[email protected]>
---
drivers/staging/rtl8723bs/hal/sdio_ops.c | 6 ++--
drivers/staging/rtl8723bs/include/drv_types.h | 2 +-
.../rtl8723bs/include/drv_types_sdio.h | 4 +--
drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 10 +++----
.../staging/rtl8723bs/os_dep/sdio_ops_linux.c | 30 +++++++++----------
5 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c
index 92191e9789bb..97b82b9e2b43 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
@@ -425,7 +425,7 @@ static u32 sdio_read_port(
)
{
struct adapter *adapter;
- PSDIO_DATA psdio;
+ struct sdio_data *psdio;
struct hal_com_data *hal;
u32 oldcnt;
s32 err;
@@ -473,7 +473,7 @@ static u32 sdio_write_port(
)
{
struct adapter *adapter;
- PSDIO_DATA psdio;
+ struct sdio_data *psdio;
s32 err;
struct xmit_buf *xmitbuf = (struct xmit_buf *)mem;

@@ -1207,7 +1207,7 @@ u8 RecvOnePkt(struct adapter *adapter, u32 size)
{
struct recv_buf *recvbuf;
struct dvobj_priv *sddev;
- PSDIO_DATA psdio_data;
+ struct sdio_data *psdio_data;
struct sdio_func *func;

u8 res = false;
diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h
index bafb2c30e7fb..b0623c936940 100644
--- a/drivers/staging/rtl8723bs/include/drv_types.h
+++ b/drivers/staging/rtl8723bs/include/drv_types.h
@@ -220,7 +220,7 @@ struct registry_priv
#define BSSID_SZ(field) sizeof(((struct wlan_bssid_ex *) 0)->field)

#include <drv_types_sdio.h>
-#define INTF_DATA SDIO_DATA
+#define INTF_DATA struct sdio_data

#define is_primary_adapter(adapter) (1)
#define get_iface_type(adapter) (IFACE_PORT0)
diff --git a/drivers/staging/rtl8723bs/include/drv_types_sdio.h b/drivers/staging/rtl8723bs/include/drv_types_sdio.h
index 23bf30ece2df..09263ad27ce9 100644
--- a/drivers/staging/rtl8723bs/include/drv_types_sdio.h
+++ b/drivers/staging/rtl8723bs/include/drv_types_sdio.h
@@ -16,7 +16,7 @@
#include <linux/mmc/card.h>
#endif

-typedef struct sdio_data
+struct sdio_data
{
u8 func_number;

@@ -26,6 +26,6 @@ typedef struct sdio_data

struct sdio_func *func;
void *sys_sdio_irq_thd;
-} SDIO_DATA, *PSDIO_DATA;
+};

#endif
diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
index 6d02904de63f..052482554f74 100644
--- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
+++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
@@ -74,7 +74,7 @@ static void sd_sync_int_hdl(struct sdio_func *func)

static int sdio_alloc_irq(struct dvobj_priv *dvobj)
{
- PSDIO_DATA psdio_data;
+ struct sdio_data *psdio_data;
struct sdio_func *func;
int err;

@@ -102,7 +102,7 @@ static int sdio_alloc_irq(struct dvobj_priv *dvobj)

static void sdio_free_irq(struct dvobj_priv *dvobj)
{
- PSDIO_DATA psdio_data;
+ struct sdio_data *psdio_data;
struct sdio_func *func;
int err;

@@ -176,7 +176,7 @@ static void gpio_hostwakeup_free_irq(struct adapter *padapter)

static u32 sdio_init(struct dvobj_priv *dvobj)
{
- PSDIO_DATA psdio_data;
+ struct sdio_data *psdio_data;
struct sdio_func *func;
int err;

@@ -248,7 +248,7 @@ static struct dvobj_priv *sdio_dvobj_init(struct sdio_func *func)
{
int status = _FAIL;
struct dvobj_priv *dvobj = NULL;
- PSDIO_DATA psdio;
+ struct sdio_data *psdio;

dvobj = devobj_init();
if (dvobj == NULL) {
@@ -327,7 +327,7 @@ static struct adapter *rtw_sdio_if1_init(struct dvobj_priv *dvobj, const struct
int status = _FAIL;
struct net_device *pnetdev;
struct adapter *padapter = NULL;
- PSDIO_DATA psdio = &dvobj->intf_data;
+ struct sdio_data *psdio = &dvobj->intf_data;

padapter = vzalloc(sizeof(*padapter));
if (padapter == NULL) {
diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c b/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c
index 43a9d922e3aa..1787534487b4 100644
--- a/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c
@@ -12,7 +12,7 @@
static bool rtw_sdio_claim_host_needed(struct sdio_func *func)
{
struct dvobj_priv *dvobj = sdio_get_drvdata(func);
- PSDIO_DATA sdio_data = &dvobj->intf_data;
+ struct sdio_data *sdio_data = &dvobj->intf_data;

if (sdio_data->sys_sdio_irq_thd && sdio_data->sys_sdio_irq_thd == current)
return false;
@@ -21,7 +21,7 @@ static bool rtw_sdio_claim_host_needed(struct sdio_func *func)

inline void rtw_sdio_set_irq_thd(struct dvobj_priv *dvobj, void *thd_hdl)
{
- PSDIO_DATA sdio_data = &dvobj->intf_data;
+ struct sdio_data *sdio_data = &dvobj->intf_data;

sdio_data->sys_sdio_irq_thd = thd_hdl;
}
@@ -30,7 +30,7 @@ u8 sd_f0_read8(struct intf_hdl *pintfhdl, u32 addr, s32 *err)
{
struct adapter *padapter;
struct dvobj_priv *psdiodev;
- PSDIO_DATA psdio;
+ struct sdio_data *psdio;

u8 v = 0;
struct sdio_func *func;
@@ -67,7 +67,7 @@ s32 _sd_cmd52_read(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pdata)
{
struct adapter *padapter;
struct dvobj_priv *psdiodev;
- PSDIO_DATA psdio;
+ struct sdio_data *psdio;

int err = 0, i;
struct sdio_func *func;
@@ -102,7 +102,7 @@ s32 sd_cmd52_read(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pdata)
{
struct adapter *padapter;
struct dvobj_priv *psdiodev;
- PSDIO_DATA psdio;
+ struct sdio_data *psdio;

int err = 0;
struct sdio_func *func;
@@ -137,7 +137,7 @@ s32 _sd_cmd52_write(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pdata)
{
struct adapter *padapter;
struct dvobj_priv *psdiodev;
- PSDIO_DATA psdio;
+ struct sdio_data *psdio;

int err = 0, i;
struct sdio_func *func;
@@ -172,7 +172,7 @@ s32 sd_cmd52_write(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pdata)
{
struct adapter *padapter;
struct dvobj_priv *psdiodev;
- PSDIO_DATA psdio;
+ struct sdio_data *psdio;

int err = 0;
struct sdio_func *func;
@@ -202,7 +202,7 @@ u8 sd_read8(struct intf_hdl *pintfhdl, u32 addr, s32 *err)
{
struct adapter *padapter;
struct dvobj_priv *psdiodev;
- PSDIO_DATA psdio;
+ struct sdio_data *psdio;

u8 v = 0;
struct sdio_func *func;
@@ -234,7 +234,7 @@ u32 sd_read32(struct intf_hdl *pintfhdl, u32 addr, s32 *err)
{
struct adapter *padapter;
struct dvobj_priv *psdiodev;
- PSDIO_DATA psdio;
+ struct sdio_data *psdio;
u32 v = 0;
struct sdio_func *func;
bool claim_needed;
@@ -299,7 +299,7 @@ void sd_write8(struct intf_hdl *pintfhdl, u32 addr, u8 v, s32 *err)
{
struct adapter *padapter;
struct dvobj_priv *psdiodev;
- PSDIO_DATA psdio;
+ struct sdio_data *psdio;
struct sdio_func *func;
bool claim_needed;

@@ -328,7 +328,7 @@ void sd_write32(struct intf_hdl *pintfhdl, u32 addr, u32 v, s32 *err)
{
struct adapter *padapter;
struct dvobj_priv *psdiodev;
- PSDIO_DATA psdio;
+ struct sdio_data *psdio;
struct sdio_func *func;
bool claim_needed;

@@ -404,7 +404,7 @@ s32 _sd_read(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, void *pdata)
{
struct adapter *padapter;
struct dvobj_priv *psdiodev;
- PSDIO_DATA psdio;
+ struct sdio_data *psdio;

int err = -EPERM;
struct sdio_func *func;
@@ -461,7 +461,7 @@ s32 sd_read(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, void *pdata)
{
struct adapter *padapter;
struct dvobj_priv *psdiodev;
- PSDIO_DATA psdio;
+ struct sdio_data *psdio;

struct sdio_func *func;
bool claim_needed;
@@ -505,7 +505,7 @@ s32 _sd_write(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, void *pdata)
{
struct adapter *padapter;
struct dvobj_priv *psdiodev;
- PSDIO_DATA psdio;
+ struct sdio_data *psdio;

struct sdio_func *func;
u32 size;
@@ -565,7 +565,7 @@ s32 sd_write(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, void *pdata)
{
struct adapter *padapter;
struct dvobj_priv *psdiodev;
- PSDIO_DATA psdio;
+ struct sdio_data *psdio;
struct sdio_func *func;
bool claim_needed;
s32 err = -EPERM;
--
2.17.1


2019-04-10 06:52:32

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH] Staging: rtl8723bs: Remove typedef in struct sdio_data

On Tue, Apr 09, 2019 at 11:16:17AM -0500, Madhumitha Prabakaran wrote:
> diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h
> index bafb2c30e7fb..b0623c936940 100644
> --- a/drivers/staging/rtl8723bs/include/drv_types.h
> +++ b/drivers/staging/rtl8723bs/include/drv_types.h
> @@ -220,7 +220,7 @@ struct registry_priv
> #define BSSID_SZ(field) sizeof(((struct wlan_bssid_ex *) 0)->field)
>
> #include <drv_types_sdio.h>
> -#define INTF_DATA SDIO_DATA
> +#define INTF_DATA struct sdio_data
>

Just get rid of INTF_DATA data as well. It's only used once a bit lower
in the file. (Get rid of the ifdef around it).

regards,
dan carpenter



2019-04-10 19:51:22

by Madhumitha Prabakaran

[permalink] [raw]
Subject: Re: [PATCH] Staging: rtl8723bs: Remove typedef in struct sdio_data

On Wed, Apr 10, 2019 at 09:49:54AM +0300, Dan Carpenter wrote:
> On Tue, Apr 09, 2019 at 11:16:17AM -0500, Madhumitha Prabakaran wrote:
> > diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h
> > index bafb2c30e7fb..b0623c936940 100644
> > --- a/drivers/staging/rtl8723bs/include/drv_types.h
> > +++ b/drivers/staging/rtl8723bs/include/drv_types.h
> > @@ -220,7 +220,7 @@ struct registry_priv
> > #define BSSID_SZ(field) sizeof(((struct wlan_bssid_ex *) 0)->field)
> >
> > #include <drv_types_sdio.h>
> > -#define INTF_DATA SDIO_DATA
> > +#define INTF_DATA struct sdio_data
> >
>
> Just get rid of INTF_DATA data as well. It's only used once a bit lower
> in the file. (Get rid of the ifdef around it).

But, reference of INTF_DATA is also included in file
./drivers/staging/rtl8723bs/include/drv_types.h:487:
return &dvobj->intf_data.func->dev;

thanks for the review
madhumitha


>
> regards,
> dan carpenter
>
>
>

2019-04-11 07:23:27

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH] Staging: rtl8723bs: Remove typedef in struct sdio_data

On Wed, Apr 10, 2019 at 02:49:09PM -0500, Madhumthia Prabakaran wrote:
> On Wed, Apr 10, 2019 at 09:49:54AM +0300, Dan Carpenter wrote:
> > On Tue, Apr 09, 2019 at 11:16:17AM -0500, Madhumitha Prabakaran wrote:
> > > diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h
> > > index bafb2c30e7fb..b0623c936940 100644
> > > --- a/drivers/staging/rtl8723bs/include/drv_types.h
> > > +++ b/drivers/staging/rtl8723bs/include/drv_types.h
> > > @@ -220,7 +220,7 @@ struct registry_priv
> > > #define BSSID_SZ(field) sizeof(((struct wlan_bssid_ex *) 0)->field)
> > >
> > > #include <drv_types_sdio.h>
> > > -#define INTF_DATA SDIO_DATA
> > > +#define INTF_DATA struct sdio_data
> > >
> >
> > Just get rid of INTF_DATA data as well. It's only used once a bit lower
> > in the file. (Get rid of the ifdef around it).
>
> But, reference of INTF_DATA is also included in file
> ./drivers/staging/rtl8723bs/include/drv_types.h:487:
> return &dvobj->intf_data.func->dev;
>

Yes. That's what I meant. Get rid of that one and the ifdefs around
it.

regards,
dan carpenter

2019-04-11 08:16:07

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH] Staging: rtl8723bs: Remove typedef in struct sdio_data

On Wed, Apr 10, 2019 at 02:49:09PM -0500, Madhumthia Prabakaran wrote:
> On Wed, Apr 10, 2019 at 09:49:54AM +0300, Dan Carpenter wrote:
> > On Tue, Apr 09, 2019 at 11:16:17AM -0500, Madhumitha Prabakaran wrote:
> > > diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h
> > > index bafb2c30e7fb..b0623c936940 100644
> > > --- a/drivers/staging/rtl8723bs/include/drv_types.h
> > > +++ b/drivers/staging/rtl8723bs/include/drv_types.h
> > > @@ -220,7 +220,7 @@ struct registry_priv
> > > #define BSSID_SZ(field) sizeof(((struct wlan_bssid_ex *) 0)->field)
> > >
> > > #include <drv_types_sdio.h>
> > > -#define INTF_DATA SDIO_DATA
> > > +#define INTF_DATA struct sdio_data
> > >
> >
> > Just get rid of INTF_DATA data as well. It's only used once a bit lower
> > in the file. (Get rid of the ifdef around it).
>
> But, reference of INTF_DATA is also included in file
> ./drivers/staging/rtl8723bs/include/drv_types.h:487:
> return &dvobj->intf_data.func->dev;
>

Actually, I maybe misunderstood your email. I'm not sure what you mean
about "&dvobj->intf_data.func->dev;". I just meant to replace
INTF_DATA with "struct sdio_data".

regards,
dan carpenter

2019-04-11 15:35:08

by Madhumitha Prabakaran

[permalink] [raw]
Subject: Re: [PATCH] Staging: rtl8723bs: Remove typedef in struct sdio_data

On Thu, Apr 11, 2019 at 11:13:28AM +0300, Dan Carpenter wrote:
> On Wed, Apr 10, 2019 at 02:49:09PM -0500, Madhumthia Prabakaran wrote:
> > On Wed, Apr 10, 2019 at 09:49:54AM +0300, Dan Carpenter wrote:
> > > On Tue, Apr 09, 2019 at 11:16:17AM -0500, Madhumitha Prabakaran wrote:
> > > > diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h
> > > > index bafb2c30e7fb..b0623c936940 100644
> > > > --- a/drivers/staging/rtl8723bs/include/drv_types.h
> > > > +++ b/drivers/staging/rtl8723bs/include/drv_types.h
> > > > @@ -220,7 +220,7 @@ struct registry_priv
> > > > #define BSSID_SZ(field) sizeof(((struct wlan_bssid_ex *) 0)->field)
> > > >
> > > > #include <drv_types_sdio.h>
> > > > -#define INTF_DATA SDIO_DATA
> > > > +#define INTF_DATA struct sdio_data
> > > >
> > >
> > > Just get rid of INTF_DATA data as well. It's only used once a bit lower
> > > in the file. (Get rid of the ifdef around it).
> >
> > But, reference of INTF_DATA is also included in file
> > ./drivers/staging/rtl8723bs/include/drv_types.h:487:
> > return &dvobj->intf_data.func->dev;
> >
>
> Actually, I maybe misunderstood your email. I'm not sure what you mean
> about "&dvobj->intf_data.func->dev;". I just meant to replace
> INTF_DATA with "struct sdio_data".

Sorry, I wasn't able to align my thoughts over ifdef. Thus, the
confusion in fixing it.

However, I edited it now.

Thanks,
Madhumitha


>
> regards,
> dan carpenter
>