public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH rdma-next] IB/core: Remove pointer casting from void to net_device
@ 2017-02-01 11:51 Leon Romanovsky
       [not found] ` <20170201115126.7313-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Leon Romanovsky @ 2017-02-01 11:51 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Parav Pandit

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

This patch avoids unnecessary type casting from void to net_device.

Signed-off-by: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 drivers/infiniband/core/roce_gid_mgmt.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/infiniband/core/roce_gid_mgmt.c b/drivers/infiniband/core/roce_gid_mgmt.c
index 0621f4455732..8c1f99f830d4 100644
--- a/drivers/infiniband/core/roce_gid_mgmt.c
+++ b/drivers/infiniband/core/roce_gid_mgmt.c
@@ -144,7 +144,7 @@ static enum bonding_slave_state is_eth_active_slave_of_bonding_rcu(struct net_de
 static int is_eth_port_of_netdev(struct ib_device *ib_dev, u8 port,
 				 struct net_device *rdma_ndev, void *cookie)
 {
-	struct net_device *event_ndev = (struct net_device *)cookie;
+	struct net_device *event_ndev = cookie;
 	struct net_device *real_dev;
 	int res;

@@ -192,7 +192,7 @@ static int pass_all_filter(struct ib_device *ib_dev, u8 port,
 static int upper_device_filter(struct ib_device *ib_dev, u8 port,
 			       struct net_device *rdma_ndev, void *cookie)
 {
-	struct net_device *event_ndev = (struct net_device *)cookie;
+	struct net_device *event_ndev = cookie;
 	int res;

 	if (!rdma_ndev)
@@ -379,7 +379,7 @@ static void _add_netdev_ips(struct ib_device *ib_dev, u8 port,
 static void add_netdev_ips(struct ib_device *ib_dev, u8 port,
 			   struct net_device *rdma_ndev, void *cookie)
 {
-	struct net_device *event_ndev = (struct net_device *)cookie;
+	struct net_device *event_ndev = cookie;

 	enum_netdev_default_gids(ib_dev, port, event_ndev, rdma_ndev);
 	_add_netdev_ips(ib_dev, port, event_ndev);
@@ -388,7 +388,7 @@ static void add_netdev_ips(struct ib_device *ib_dev, u8 port,
 static void del_netdev_ips(struct ib_device *ib_dev, u8 port,
 			   struct net_device *rdma_ndev, void *cookie)
 {
-	struct net_device *event_ndev = (struct net_device *)cookie;
+	struct net_device *event_ndev = cookie;

 	ib_cache_gid_del_all_netdev_gids(ib_dev, port, event_ndev);
 }
@@ -460,7 +460,7 @@ static void handle_netdev_upper(struct ib_device *ib_dev, u8 port,
 						      u8 port,
 						      struct net_device *ndev))
 {
-	struct net_device *ndev = (struct net_device *)cookie;
+	struct net_device *ndev = cookie;
 	struct upper_list *upper_iter;
 	struct upper_list *upper_temp;
 	LIST_HEAD(upper_list);
@@ -519,7 +519,7 @@ static void del_netdev_default_ips_join(struct ib_device *ib_dev, u8 port,
 static void del_netdev_default_ips(struct ib_device *ib_dev, u8 port,
 				   struct net_device *rdma_ndev, void *cookie)
 {
-	struct net_device *event_ndev = (struct net_device *)cookie;
+	struct net_device *event_ndev = cookie;

 	bond_delete_netdev_default_gids(ib_dev, port, event_ndev, rdma_ndev);
 }
--
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH rdma-next] IB/core: Remove pointer casting from void to net_device
       [not found] ` <20170201115126.7313-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2017-02-01 13:18   ` Yuval Shaia
  2017-02-01 17:05     ` Leon Romanovsky
  0 siblings, 1 reply; 3+ messages in thread
From: Yuval Shaia @ 2017-02-01 13:18 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, Parav Pandit

On Wed, Feb 01, 2017 at 01:51:26PM +0200, Leon Romanovsky wrote:
> From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> This patch avoids unnecessary type casting from void to net_device.

How about going one step further and get rid of this temporary event_ndev
variable?

> 
> Signed-off-by: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> ---
>  drivers/infiniband/core/roce_gid_mgmt.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/infiniband/core/roce_gid_mgmt.c b/drivers/infiniband/core/roce_gid_mgmt.c
> index 0621f4455732..8c1f99f830d4 100644
> --- a/drivers/infiniband/core/roce_gid_mgmt.c
> +++ b/drivers/infiniband/core/roce_gid_mgmt.c
> @@ -144,7 +144,7 @@ static enum bonding_slave_state is_eth_active_slave_of_bonding_rcu(struct net_de
>  static int is_eth_port_of_netdev(struct ib_device *ib_dev, u8 port,
>  				 struct net_device *rdma_ndev, void *cookie)
>  {
> -	struct net_device *event_ndev = (struct net_device *)cookie;
> +	struct net_device *event_ndev = cookie;
>  	struct net_device *real_dev;
>  	int res;
> 
> @@ -192,7 +192,7 @@ static int pass_all_filter(struct ib_device *ib_dev, u8 port,
>  static int upper_device_filter(struct ib_device *ib_dev, u8 port,
>  			       struct net_device *rdma_ndev, void *cookie)
>  {
> -	struct net_device *event_ndev = (struct net_device *)cookie;
> +	struct net_device *event_ndev = cookie;
>  	int res;
> 
>  	if (!rdma_ndev)
> @@ -379,7 +379,7 @@ static void _add_netdev_ips(struct ib_device *ib_dev, u8 port,
>  static void add_netdev_ips(struct ib_device *ib_dev, u8 port,
>  			   struct net_device *rdma_ndev, void *cookie)
>  {
> -	struct net_device *event_ndev = (struct net_device *)cookie;
> +	struct net_device *event_ndev = cookie;
> 
>  	enum_netdev_default_gids(ib_dev, port, event_ndev, rdma_ndev);
>  	_add_netdev_ips(ib_dev, port, event_ndev);
> @@ -388,7 +388,7 @@ static void add_netdev_ips(struct ib_device *ib_dev, u8 port,
>  static void del_netdev_ips(struct ib_device *ib_dev, u8 port,
>  			   struct net_device *rdma_ndev, void *cookie)
>  {
> -	struct net_device *event_ndev = (struct net_device *)cookie;
> +	struct net_device *event_ndev = cookie;
> 
>  	ib_cache_gid_del_all_netdev_gids(ib_dev, port, event_ndev);
>  }
> @@ -460,7 +460,7 @@ static void handle_netdev_upper(struct ib_device *ib_dev, u8 port,
>  						      u8 port,
>  						      struct net_device *ndev))
>  {
> -	struct net_device *ndev = (struct net_device *)cookie;
> +	struct net_device *ndev = cookie;
>  	struct upper_list *upper_iter;
>  	struct upper_list *upper_temp;
>  	LIST_HEAD(upper_list);
> @@ -519,7 +519,7 @@ static void del_netdev_default_ips_join(struct ib_device *ib_dev, u8 port,
>  static void del_netdev_default_ips(struct ib_device *ib_dev, u8 port,
>  				   struct net_device *rdma_ndev, void *cookie)
>  {
> -	struct net_device *event_ndev = (struct net_device *)cookie;
> +	struct net_device *event_ndev = cookie;
> 
>  	bond_delete_netdev_default_gids(ib_dev, port, event_ndev, rdma_ndev);
>  }
> --
> 2.11.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH rdma-next] IB/core: Remove pointer casting from void to net_device
  2017-02-01 13:18   ` Yuval Shaia
@ 2017-02-01 17:05     ` Leon Romanovsky
  0 siblings, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2017-02-01 17:05 UTC (permalink / raw)
  To: Yuval Shaia
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, Parav Pandit

[-- Attachment #1: Type: text/plain, Size: 404 bytes --]

On Wed, Feb 01, 2017 at 03:18:46PM +0200, Yuval Shaia wrote:
> On Wed, Feb 01, 2017 at 01:51:26PM +0200, Leon Romanovsky wrote:
> > From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> >
> > This patch avoids unnecessary type casting from void to net_device.
>
> How about going one step further and get rid of this temporary event_ndev
> variable?

Sure, I'll send updated patch.
Thanks

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-01 17:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-01 11:51 [PATCH rdma-next] IB/core: Remove pointer casting from void to net_device Leon Romanovsky
     [not found] ` <20170201115126.7313-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-02-01 13:18   ` Yuval Shaia
2017-02-01 17:05     ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox