mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
param: use ops in struct kernel_param, rather than get and set fns directly
This is more kernel-ish, saves some space, and also allows us to expand the ops without breaking all the callers who are happy for the new members to be NULL. The few places which defined their own param types are changed to the new scheme (more which crept in recently fixed in following patches). Since we're touching them anyway, we change get() and set() to take a const struct kernel_param (which they really are). This causes some harmless warnings until we fix them (in following patches). To reduce churn, module_param_call creates the ops struct so the callers don't have to change (and casts the functions to reduce warnings). The modern version which takes an ops struct is called module_param_cb. Signed-off-by: Rusty Russell <[email protected]> Reviewed-by: Takashi Iwai <[email protected]> Tested-by: Phil Carmody <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Ville Syrjala <[email protected]> Cc: Dmitry Torokhov <[email protected]> Cc: Alessandro Rubini <[email protected]> Cc: Michal Januszewski <[email protected]> Cc: Trond Myklebust <[email protected]> Cc: "J. Bruce Fields" <[email protected]> Cc: Neil Brown <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected]
This commit is contained in:
parent
a14fe249a8
commit
9bbb9e5a33
7 changed files with 186 additions and 111 deletions
|
|
@ -2577,7 +2577,8 @@ void cleanup_socket_xprt(void)
|
|||
xprt_unregister_transport(&xs_bc_tcp_transport);
|
||||
}
|
||||
|
||||
static int param_set_uint_minmax(const char *val, struct kernel_param *kp,
|
||||
static int param_set_uint_minmax(const char *val,
|
||||
const struct kernel_param *kp,
|
||||
unsigned int min, unsigned int max)
|
||||
{
|
||||
unsigned long num;
|
||||
|
|
@ -2592,34 +2593,37 @@ static int param_set_uint_minmax(const char *val, struct kernel_param *kp,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int param_set_portnr(const char *val, struct kernel_param *kp)
|
||||
static int param_set_portnr(const char *val, const struct kernel_param *kp)
|
||||
{
|
||||
return param_set_uint_minmax(val, kp,
|
||||
RPC_MIN_RESVPORT,
|
||||
RPC_MAX_RESVPORT);
|
||||
}
|
||||
|
||||
static int param_get_portnr(char *buffer, struct kernel_param *kp)
|
||||
{
|
||||
return param_get_uint(buffer, kp);
|
||||
}
|
||||
static struct kernel_param_ops param_ops_portnr = {
|
||||
.set = param_set_portnr,
|
||||
.get = param_get_uint,
|
||||
};
|
||||
|
||||
#define param_check_portnr(name, p) \
|
||||
__param_check(name, p, unsigned int);
|
||||
|
||||
module_param_named(min_resvport, xprt_min_resvport, portnr, 0644);
|
||||
module_param_named(max_resvport, xprt_max_resvport, portnr, 0644);
|
||||
|
||||
static int param_set_slot_table_size(const char *val, struct kernel_param *kp)
|
||||
static int param_set_slot_table_size(const char *val,
|
||||
const struct kernel_param *kp)
|
||||
{
|
||||
return param_set_uint_minmax(val, kp,
|
||||
RPC_MIN_SLOT_TABLE,
|
||||
RPC_MAX_SLOT_TABLE);
|
||||
}
|
||||
|
||||
static int param_get_slot_table_size(char *buffer, struct kernel_param *kp)
|
||||
{
|
||||
return param_get_uint(buffer, kp);
|
||||
}
|
||||
static struct kernel_param_ops param_ops_slot_table_size = {
|
||||
.set = param_set_slot_table_size,
|
||||
.get = param_get_uint,
|
||||
};
|
||||
|
||||
#define param_check_slot_table_size(name, p) \
|
||||
__param_check(name, p, unsigned int);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue