On (03/15/19 12:31), David Laight wrote:
> From: Sergey Senozhatsky
> > 
> > cpu_to_le32() is capable enough to detect __builtin_constant_p()
> > and to use an appropriate compile time ___constant_swahb32()
> > function.
> > 
> > So we can use cpu_to_le32() instead of __constant_cpu_to_le32().
> 
> Unless any code tries to use them as case statement labels.

What is the problem?

For compile time constants cpu_to_le32() should do the same thing
as __constant_cpu_to_le32().

There seems a whole bunch of cpu_to_XX compile time constants which
are used in case statement labels

include/linux/sunrpc/xdr.h:#define      rpc_msg_accepted        
cpu_to_be32(RPC_MSG_ACCEPTED)
include/linux/sunrpc/xdr.h:#define      rpc_success             
cpu_to_be32(RPC_SUCCESS)
include/linux/sunrpc/xdr.h:#define      rpc_prog_unavail        
cpu_to_be32(RPC_PROG_UNAVAIL)
include/linux/sunrpc/xdr.h:#define      rpc_prog_mismatch       
cpu_to_be32(RPC_PROG_MISMATCH)
include/linux/sunrpc/xdr.h:#define      rpc_proc_unavail        
cpu_to_be32(RPC_PROC_UNAVAIL)
include/linux/sunrpc/xdr.h:#define      rpc_garbage_args        
cpu_to_be32(RPC_GARBAGE_ARGS)
include/linux/sunrpc/xdr.h:#define      rpc_system_err          
cpu_to_be32(RPC_SYSTEM_ERR)
include/linux/sunrpc/xdr.h:#define      rpc_drop_reply          
cpu_to_be32(RPC_DROP_REPLY)
include/linux/sunrpc/xdr.h:#define      rpc_mismatch            
cpu_to_be32(RPC_MISMATCH)
include/linux/sunrpc/xdr.h:#define      rpc_auth_error          
cpu_to_be32(RPC_AUTH_ERROR)
include/linux/sunrpc/xdr.h:#define      rpc_auth_ok             
cpu_to_be32(RPC_AUTH_OK)
include/linux/sunrpc/xdr.h:#define      rpc_autherr_badcred     
cpu_to_be32(RPC_AUTH_BADCRED)
include/linux/sunrpc/xdr.h:#define      rpc_autherr_rejectedcred 
cpu_to_be32(RPC_AUTH_REJECTEDCRED)
include/linux/sunrpc/xdr.h:#define      rpc_autherr_badverf     
cpu_to_be32(RPC_AUTH_BADVERF)
include/linux/sunrpc/xdr.h:#define      rpc_autherr_rejectedverf 
cpu_to_be32(RPC_AUTH_REJECTEDVERF)
include/linux/sunrpc/xdr.h:#define      rpc_autherr_tooweak     
cpu_to_be32(RPC_AUTH_TOOWEAK)


net/sunrpc/clnt.c

2479         switch (*p) {
2480         case rpc_success:
2481                 return 0;
2482         case rpc_prog_unavail:
2483                 trace_rpc__prog_unavail(task);
2484                 error = -EPFNOSUPPORT;
2485                 goto out_err;
2486         case rpc_prog_mismatch:
2487                 trace_rpc__prog_mismatch(task);
2488                 error = -EPROTONOSUPPORT;
2489                 goto out_err;
2490         case rpc_proc_unavail:
2491                 trace_rpc__proc_unavail(task);
2492                 error = -EOPNOTSUPP;
2493                 goto out_err;
2494         case rpc_garbage_args:
2495                 trace_rpc__garbage_args(task);
2496                 break;
2497         default:
2498                 trace_rpc__unparsable(task);
2499         }

        -ss

Reply via email to