Re: [PATCH 1/2] ata: ahci: Create a ahci_get_port_map_helper() helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/16/25 23:36, Niklas Cassel wrote:
> Create a ahci_get_port_map_helper() helper so that this code can be reused
> by other module parameters that are saved in a port bitmap.
> 
> Signed-off-by: Niklas Cassel <cassel@xxxxxxxxxx>
> ---
>  drivers/ata/ahci.c | 48 +++++++++++++++++++++++++++++-----------------
>  1 file changed, 30 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
> index 8d27c567be1c..92b08d3a0c3c 100644
> --- a/drivers/ata/ahci.c
> +++ b/drivers/ata/ahci.c
> @@ -676,35 +676,27 @@ MODULE_PARM_DESC(mask_port_map,
>  		 "where <pci_dev> is the PCI ID of an AHCI controller in the "
>  		 "form \"domain:bus:dev.func\"");
>  
> -static void ahci_apply_port_map_mask(struct device *dev,
> -				     struct ahci_host_priv *hpriv, char *mask_s)
> -{
> -	unsigned int mask;
> -
> -	if (kstrtouint(mask_s, 0, &mask)) {
> -		dev_err(dev, "Invalid port map mask\n");
> -		return;
> -	}
> -
> -	hpriv->mask_port_map = mask;
> -}
> +typedef void (*port_map_callback_t)(struct device *dev,
> +				    struct ahci_host_priv *hpriv, char *mask_s);
>  
> -static void ahci_get_port_map_mask(struct device *dev,
> -				   struct ahci_host_priv *hpriv)
> +static void ahci_get_port_map_helper(struct device *dev,

Can we drop the "_helper" at the end of the name ?

> +				     struct ahci_host_priv *hpriv,
> +				     const char *module_str,
> +				     port_map_callback_t apply_cb)

And maybe change this to "apply_port_map_mask_cb" to be clear about what is
being applied ?


-- 
Damien Le Moal
Western Digital Research




[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux