diff mbox series

[v1,2/3] x86/quirks: Introduce hpet_dev_print_force_hpet_address() helper

Message ID 20211119110017.48510-2-andriy.shevchenko@linux.intel.com (mailing list archive)
State Changes Requested
Delegated to: Bjorn Helgaas
Headers show
Series [v1,1/3] x86/quirks: Add missed include to satisfy static checker | expand

Commit Message

Andy Shevchenko Nov. 19, 2021, 11 a.m. UTC
Introduce hpet_dev_print_force_hpet_address() helper to unify printing
forced HPET address. No functional change intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 arch/x86/kernel/quirks.c | 32 ++++++++++++++------------------
 1 file changed, 14 insertions(+), 18 deletions(-)

Comments

Joe Perches Nov. 19, 2021, 11:20 a.m. UTC | #1
On Fri, 2021-11-19 at 13:00 +0200, Andy Shevchenko wrote:
> Introduce hpet_dev_print_force_hpet_address() helper to unify printing
> forced HPET address. No functional change intended.

This probably reduces object code by a few bytes of text.

> diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c
[]
> @@ -68,6 +68,11 @@ static enum {
>  	ATI_FORCE_HPET_RESUME,
>  } force_hpet_resume_type;
>  
> +static void hpet_dev_print_force_hpet_address(struct device *dev)
> +{
> +	dev_printk(KERN_DEBUG, dev, "Force enabled HPET at 0x%lx\n", force_hpet_address);
> +}

And this might be better placed up a few lines immediately after

unsigned long force_hpet_address;

and before

enum {
	...
} force_hpet_resume_type;
Bjorn Helgaas Nov. 19, 2021, 6:35 p.m. UTC | #2
On Fri, Nov 19, 2021 at 01:00:16PM +0200, Andy Shevchenko wrote:
> Introduce hpet_dev_print_force_hpet_address() helper to unify printing
> forced HPET address. No functional change intended.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  arch/x86/kernel/quirks.c | 32 ++++++++++++++------------------
>  1 file changed, 14 insertions(+), 18 deletions(-)
> 
> diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c
> index c4bc0c3a5414..7280125aed4d 100644
> --- a/arch/x86/kernel/quirks.c
> +++ b/arch/x86/kernel/quirks.c
> @@ -68,6 +68,11 @@ static enum {
>  	ATI_FORCE_HPET_RESUME,
>  } force_hpet_resume_type;
>  
> +static void hpet_dev_print_force_hpet_address(struct device *dev)
> +{
> +	dev_printk(KERN_DEBUG, dev, "Force enabled HPET at 0x%lx\n", force_hpet_address);

Looks good to me.  Do we know the size of the HPET register size?
Could we show the entire range, e.g., "[mem %#010x-%#010x]", to match
other physical address space resources?

> +}
> +
>  static void __iomem *rcba_base;
>  
>  static void ich_force_hpet_resume(void)
> @@ -125,8 +130,7 @@ static void ich_force_enable_hpet(struct pci_dev *dev)
>  		/* HPET is enabled in HPTC. Just not reported by BIOS */
>  		val = val & 0x3;
>  		force_hpet_address = 0xFED00000 | (val << 12);
> -		dev_printk(KERN_DEBUG, &dev->dev, "Force enabled HPET at "
> -			"0x%lx\n", force_hpet_address);
> +		hpet_dev_print_force_hpet_address(&dev->dev);
>  		iounmap(rcba_base);
>  		return;
>  	}
> @@ -149,8 +153,7 @@ static void ich_force_enable_hpet(struct pci_dev *dev)
>  			"Failed to force enable HPET\n");
>  	} else {
>  		force_hpet_resume_type = ICH_FORCE_HPET_RESUME;
> -		dev_printk(KERN_DEBUG, &dev->dev, "Force enabled HPET at "
> -			"0x%lx\n", force_hpet_address);
> +		hpet_dev_print_force_hpet_address(&dev->dev);
>  	}
>  }
>  
> @@ -223,8 +226,7 @@ static void old_ich_force_enable_hpet(struct pci_dev *dev)
>  	if (val & 0x4) {
>  		val &= 0x3;
>  		force_hpet_address = 0xFED00000 | (val << 12);
> -		dev_printk(KERN_DEBUG, &dev->dev, "HPET at 0x%lx\n",
> -			force_hpet_address);
> +		hpet_dev_print_force_hpet_address(&dev->dev);
>  		return;
>  	}
>  
> @@ -244,8 +246,7 @@ static void old_ich_force_enable_hpet(struct pci_dev *dev)
>  		/* HPET is enabled in HPTC. Just not reported by BIOS */
>  		val &= 0x3;
>  		force_hpet_address = 0xFED00000 | (val << 12);
> -		dev_printk(KERN_DEBUG, &dev->dev, "Force enabled HPET at "
> -			"0x%lx\n", force_hpet_address);
> +		hpet_dev_print_force_hpet_address(&dev->dev);
>  		cached_dev = dev;
>  		force_hpet_resume_type = OLD_ICH_FORCE_HPET_RESUME;
>  		return;
> @@ -316,8 +317,7 @@ static void vt8237_force_enable_hpet(struct pci_dev *dev)
>  	 */
>  	if (val & 0x80) {
>  		force_hpet_address = (val & ~0x3ff);
> -		dev_printk(KERN_DEBUG, &dev->dev, "HPET at 0x%lx\n",
> -			force_hpet_address);
> +		hpet_dev_print_force_hpet_address(&dev->dev);
>  		return;
>  	}
>  
> @@ -331,8 +331,7 @@ static void vt8237_force_enable_hpet(struct pci_dev *dev)
>  	pci_read_config_dword(dev, 0x68, &val);
>  	if (val & 0x80) {
>  		force_hpet_address = (val & ~0x3ff);
> -		dev_printk(KERN_DEBUG, &dev->dev, "Force enabled HPET at "
> -			"0x%lx\n", force_hpet_address);
> +		hpet_dev_print_force_hpet_address(&dev->dev);
>  		cached_dev = dev;
>  		force_hpet_resume_type = VT8237_FORCE_HPET_RESUME;
>  		return;
> @@ -412,8 +411,7 @@ static void ati_force_enable_hpet(struct pci_dev *dev)
>  
>  	force_hpet_address = val;
>  	force_hpet_resume_type = ATI_FORCE_HPET_RESUME;
> -	dev_printk(KERN_DEBUG, &dev->dev, "Force enabled HPET at 0x%lx\n",
> -		   force_hpet_address);
> +	hpet_dev_print_force_hpet_address(&dev->dev);
>  	cached_dev = dev;
>  }
>  DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_SMBUS,
> @@ -444,8 +442,7 @@ static void nvidia_force_enable_hpet(struct pci_dev *dev)
>  	pci_read_config_dword(dev, 0x44, &val);
>  	force_hpet_address = val & 0xfffffffe;
>  	force_hpet_resume_type = NVIDIA_FORCE_HPET_RESUME;
> -	dev_printk(KERN_DEBUG, &dev->dev, "Force enabled HPET at 0x%lx\n",
> -		force_hpet_address);
> +	hpet_dev_print_force_hpet_address(&dev->dev);
>  	cached_dev = dev;
>  }
>  
> @@ -509,8 +506,7 @@ static void e6xx_force_enable_hpet(struct pci_dev *dev)
>  
>  	force_hpet_address = 0xFED00000;
>  	force_hpet_resume_type = NONE_FORCE_HPET_RESUME;
> -	dev_printk(KERN_DEBUG, &dev->dev, "Force enabled HPET at "
> -		"0x%lx\n", force_hpet_address);
> +	hpet_dev_print_force_hpet_address(&dev->dev);
>  }
>  DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E6XX_CU,
>  			 e6xx_force_enable_hpet);
> -- 
> 2.33.0
>
diff mbox series

Patch

diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c
index c4bc0c3a5414..7280125aed4d 100644
--- a/arch/x86/kernel/quirks.c
+++ b/arch/x86/kernel/quirks.c
@@ -68,6 +68,11 @@  static enum {
 	ATI_FORCE_HPET_RESUME,
 } force_hpet_resume_type;
 
+static void hpet_dev_print_force_hpet_address(struct device *dev)
+{
+	dev_printk(KERN_DEBUG, dev, "Force enabled HPET at 0x%lx\n", force_hpet_address);
+}
+
 static void __iomem *rcba_base;
 
 static void ich_force_hpet_resume(void)
@@ -125,8 +130,7 @@  static void ich_force_enable_hpet(struct pci_dev *dev)
 		/* HPET is enabled in HPTC. Just not reported by BIOS */
 		val = val & 0x3;
 		force_hpet_address = 0xFED00000 | (val << 12);
-		dev_printk(KERN_DEBUG, &dev->dev, "Force enabled HPET at "
-			"0x%lx\n", force_hpet_address);
+		hpet_dev_print_force_hpet_address(&dev->dev);
 		iounmap(rcba_base);
 		return;
 	}
@@ -149,8 +153,7 @@  static void ich_force_enable_hpet(struct pci_dev *dev)
 			"Failed to force enable HPET\n");
 	} else {
 		force_hpet_resume_type = ICH_FORCE_HPET_RESUME;
-		dev_printk(KERN_DEBUG, &dev->dev, "Force enabled HPET at "
-			"0x%lx\n", force_hpet_address);
+		hpet_dev_print_force_hpet_address(&dev->dev);
 	}
 }
 
@@ -223,8 +226,7 @@  static void old_ich_force_enable_hpet(struct pci_dev *dev)
 	if (val & 0x4) {
 		val &= 0x3;
 		force_hpet_address = 0xFED00000 | (val << 12);
-		dev_printk(KERN_DEBUG, &dev->dev, "HPET at 0x%lx\n",
-			force_hpet_address);
+		hpet_dev_print_force_hpet_address(&dev->dev);
 		return;
 	}
 
@@ -244,8 +246,7 @@  static void old_ich_force_enable_hpet(struct pci_dev *dev)
 		/* HPET is enabled in HPTC. Just not reported by BIOS */
 		val &= 0x3;
 		force_hpet_address = 0xFED00000 | (val << 12);
-		dev_printk(KERN_DEBUG, &dev->dev, "Force enabled HPET at "
-			"0x%lx\n", force_hpet_address);
+		hpet_dev_print_force_hpet_address(&dev->dev);
 		cached_dev = dev;
 		force_hpet_resume_type = OLD_ICH_FORCE_HPET_RESUME;
 		return;
@@ -316,8 +317,7 @@  static void vt8237_force_enable_hpet(struct pci_dev *dev)
 	 */
 	if (val & 0x80) {
 		force_hpet_address = (val & ~0x3ff);
-		dev_printk(KERN_DEBUG, &dev->dev, "HPET at 0x%lx\n",
-			force_hpet_address);
+		hpet_dev_print_force_hpet_address(&dev->dev);
 		return;
 	}
 
@@ -331,8 +331,7 @@  static void vt8237_force_enable_hpet(struct pci_dev *dev)
 	pci_read_config_dword(dev, 0x68, &val);
 	if (val & 0x80) {
 		force_hpet_address = (val & ~0x3ff);
-		dev_printk(KERN_DEBUG, &dev->dev, "Force enabled HPET at "
-			"0x%lx\n", force_hpet_address);
+		hpet_dev_print_force_hpet_address(&dev->dev);
 		cached_dev = dev;
 		force_hpet_resume_type = VT8237_FORCE_HPET_RESUME;
 		return;
@@ -412,8 +411,7 @@  static void ati_force_enable_hpet(struct pci_dev *dev)
 
 	force_hpet_address = val;
 	force_hpet_resume_type = ATI_FORCE_HPET_RESUME;
-	dev_printk(KERN_DEBUG, &dev->dev, "Force enabled HPET at 0x%lx\n",
-		   force_hpet_address);
+	hpet_dev_print_force_hpet_address(&dev->dev);
 	cached_dev = dev;
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_SMBUS,
@@ -444,8 +442,7 @@  static void nvidia_force_enable_hpet(struct pci_dev *dev)
 	pci_read_config_dword(dev, 0x44, &val);
 	force_hpet_address = val & 0xfffffffe;
 	force_hpet_resume_type = NVIDIA_FORCE_HPET_RESUME;
-	dev_printk(KERN_DEBUG, &dev->dev, "Force enabled HPET at 0x%lx\n",
-		force_hpet_address);
+	hpet_dev_print_force_hpet_address(&dev->dev);
 	cached_dev = dev;
 }
 
@@ -509,8 +506,7 @@  static void e6xx_force_enable_hpet(struct pci_dev *dev)
 
 	force_hpet_address = 0xFED00000;
 	force_hpet_resume_type = NONE_FORCE_HPET_RESUME;
-	dev_printk(KERN_DEBUG, &dev->dev, "Force enabled HPET at "
-		"0x%lx\n", force_hpet_address);
+	hpet_dev_print_force_hpet_address(&dev->dev);
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E6XX_CU,
 			 e6xx_force_enable_hpet);