diff mbox series

[net-next] net: liquidio: lio_core: Remove unnecessary (void*) conversions

Message ID 20230515084906.61491-1-yunchuan@nfschina.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: liquidio: lio_core: Remove unnecessary (void*) conversions | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 10 this patch: 10
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 18 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Wu Yunchuan May 15, 2023, 8:49 a.m. UTC
Pointer variables of void * type do not require type cast.

Signed-off-by: wuych <yunchuan@nfschina.com>
---
 drivers/net/ethernet/cavium/liquidio/lio_core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Dan Carpenter May 15, 2023, 9:28 a.m. UTC | #1
On Mon, May 15, 2023 at 04:49:06PM +0800, wuych wrote:
> Pointer variables of void * type do not require type cast.
> 
> Signed-off-by: wuych <yunchuan@nfschina.com>
> ---
>  drivers/net/ethernet/cavium/liquidio/lio_core.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/cavium/liquidio/lio_core.c b/drivers/net/ethernet/cavium/liquidio/lio_core.c
> index 882b2be06ea0..10d9dab26c92 100644
> --- a/drivers/net/ethernet/cavium/liquidio/lio_core.c
> +++ b/drivers/net/ethernet/cavium/liquidio/lio_core.c
> @@ -904,8 +904,7 @@ static
>  int liquidio_schedule_msix_droq_pkt_handler(struct octeon_droq *droq, u64 ret)
>  {
>  	struct octeon_device *oct = droq->oct_dev;
> -	struct octeon_device_priv *oct_priv =
> -	    (struct octeon_device_priv *)oct->priv;
> +	struct octeon_device_priv *oct_priv = oct->priv;
>  

Networking code needs to be in Reverse Christmas Tree order.  Longest
lines first.  This code wasn't really in Reverse Christmas Tree order
to begine with but now it's more obvious.

regards,
dan carpenter
Dan Carpenter May 15, 2023, 2:56 p.m. UTC | #2
On Mon, May 15, 2023 at 12:28:19PM +0300, Dan Carpenter wrote:
> On Mon, May 15, 2023 at 04:49:06PM +0800, wuych wrote:
> > Pointer variables of void * type do not require type cast.
> > 
> > Signed-off-by: wuych <yunchuan@nfschina.com>
> > ---
> >  drivers/net/ethernet/cavium/liquidio/lio_core.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/cavium/liquidio/lio_core.c b/drivers/net/ethernet/cavium/liquidio/lio_core.c
> > index 882b2be06ea0..10d9dab26c92 100644
> > --- a/drivers/net/ethernet/cavium/liquidio/lio_core.c
> > +++ b/drivers/net/ethernet/cavium/liquidio/lio_core.c
> > @@ -904,8 +904,7 @@ static
> >  int liquidio_schedule_msix_droq_pkt_handler(struct octeon_droq *droq, u64 ret)
> >  {
> >  	struct octeon_device *oct = droq->oct_dev;
> > -	struct octeon_device_priv *oct_priv =
> > -	    (struct octeon_device_priv *)oct->priv;
> > +	struct octeon_device_priv *oct_priv = oct->priv;
> >  
> 
> Networking code needs to be in Reverse Christmas Tree order.  Longest
> lines first.  This code wasn't really in Reverse Christmas Tree order
> to begine with but now it's more obvious.

Oh, duh.  This obviously can't be reversed because it depends on the
first declaration.  Sorry for the noise.

regards,
dan carpenter
Simon Horman May 15, 2023, 8:19 p.m. UTC | #3
On Mon, May 15, 2023 at 05:56:21PM +0300, Dan Carpenter wrote:
> On Mon, May 15, 2023 at 12:28:19PM +0300, Dan Carpenter wrote:
> > On Mon, May 15, 2023 at 04:49:06PM +0800, wuych wrote:
> > > Pointer variables of void * type do not require type cast.
> > > 
> > > Signed-off-by: wuych <yunchuan@nfschina.com>
> > > ---
> > >  drivers/net/ethernet/cavium/liquidio/lio_core.c | 6 ++----
> > >  1 file changed, 2 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/drivers/net/ethernet/cavium/liquidio/lio_core.c b/drivers/net/ethernet/cavium/liquidio/lio_core.c
> > > index 882b2be06ea0..10d9dab26c92 100644
> > > --- a/drivers/net/ethernet/cavium/liquidio/lio_core.c
> > > +++ b/drivers/net/ethernet/cavium/liquidio/lio_core.c
> > > @@ -904,8 +904,7 @@ static
> > >  int liquidio_schedule_msix_droq_pkt_handler(struct octeon_droq *droq, u64 ret)
> > >  {
> > >  	struct octeon_device *oct = droq->oct_dev;
> > > -	struct octeon_device_priv *oct_priv =
> > > -	    (struct octeon_device_priv *)oct->priv;
> > > +	struct octeon_device_priv *oct_priv = oct->priv;
> > >  
> > 
> > Networking code needs to be in Reverse Christmas Tree order.  Longest
> > lines first.  This code wasn't really in Reverse Christmas Tree order
> > to begine with but now it's more obvious.
> 
> Oh, duh.  This obviously can't be reversed because it depends on the
> first declaration.  Sorry for the noise.

FWIIW, I think the preferred approach for such cases is to
separate the declaration and initialisation. Something like:

	struct octeon_device *oct = droq->oct_dev;
	struct octeon_device_priv *oct_priv;

	oct_priv = oct->priv;
Jakub Kicinski May 17, 2023, 3:20 a.m. UTC | #4
On Mon, 15 May 2023 22:19:31 +0200 Simon Horman wrote:
> On Mon, May 15, 2023 at 05:56:21PM +0300, Dan Carpenter wrote:
> > On Mon, May 15, 2023 at 12:28:19PM +0300, Dan Carpenter wrote:  
> > > Networking code needs to be in Reverse Christmas Tree order.  Longest
> > > lines first.  This code wasn't really in Reverse Christmas Tree order
> > > to begine with but now it's more obvious.  
> > 
> > Oh, duh.  This obviously can't be reversed because it depends on the
> > first declaration.  Sorry for the noise.  
> 
> FWIIW, I think the preferred approach for such cases is to
> separate the declaration and initialisation. Something like:
> 
> 	struct octeon_device *oct = droq->oct_dev;
> 	struct octeon_device_priv *oct_priv;
> 
> 	oct_priv = oct->priv;

I don't think these changes are worth bothering with at all, TBH.
Simon Horman May 17, 2023, 9:35 a.m. UTC | #5
On Tue, May 16, 2023 at 08:20:59PM -0700, Jakub Kicinski wrote:
> On Mon, 15 May 2023 22:19:31 +0200 Simon Horman wrote:
> > On Mon, May 15, 2023 at 05:56:21PM +0300, Dan Carpenter wrote:
> > > On Mon, May 15, 2023 at 12:28:19PM +0300, Dan Carpenter wrote:  
> > > > Networking code needs to be in Reverse Christmas Tree order.  Longest
> > > > lines first.  This code wasn't really in Reverse Christmas Tree order
> > > > to begine with but now it's more obvious.  
> > > 
> > > Oh, duh.  This obviously can't be reversed because it depends on the
> > > first declaration.  Sorry for the noise.  
> > 
> > FWIIW, I think the preferred approach for such cases is to
> > separate the declaration and initialisation. Something like:
> > 
> > 	struct octeon_device *oct = droq->oct_dev;
> > 	struct octeon_device_priv *oct_priv;
> > 
> > 	oct_priv = oct->priv;
> 
> I don't think these changes are worth bothering with at all, TBH.

Understood.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/cavium/liquidio/lio_core.c b/drivers/net/ethernet/cavium/liquidio/lio_core.c
index 882b2be06ea0..10d9dab26c92 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_core.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_core.c
@@ -904,8 +904,7 @@  static
 int liquidio_schedule_msix_droq_pkt_handler(struct octeon_droq *droq, u64 ret)
 {
 	struct octeon_device *oct = droq->oct_dev;
-	struct octeon_device_priv *oct_priv =
-	    (struct octeon_device_priv *)oct->priv;
+	struct octeon_device_priv *oct_priv = oct->priv;
 
 	if (droq->ops.poll_mode) {
 		droq->ops.napi_fn(droq);
@@ -947,8 +946,7 @@  liquidio_msix_intr_handler(int __maybe_unused irq, void *dev)
  */
 static void liquidio_schedule_droq_pkt_handlers(struct octeon_device *oct)
 {
-	struct octeon_device_priv *oct_priv =
-		(struct octeon_device_priv *)oct->priv;
+	struct octeon_device_priv *oct_priv = oct->priv;
 	struct octeon_droq *droq;
 	u64 oq_no;