linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/3] x86/quirks: Add missed include to satisfy static checker
@ 2021-11-19 11:00 Andy Shevchenko
  2021-11-19 11:00 ` [PATCH v1 2/3] x86/quirks: Introduce hpet_dev_print_force_hpet_address() helper Andy Shevchenko
  2021-11-19 11:00 ` [PATCH v1 3/3] x86/quirks: Join string literals back Andy Shevchenko
  0 siblings, 2 replies; 5+ messages in thread
From: Andy Shevchenko @ 2021-11-19 11:00 UTC (permalink / raw)
  To: linux-pci, linux-kernel
  Cc: Bjorn Helgaas, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin, Andy Shevchenko

Static checker is not happy with

.../kernel/quirks.c:666:6: warning: symbol 'x86_apple_machine' was not declared. Should it be static?

This is due to missed inclusion. Add it to satisfy the static checker.

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

diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c
index 1b10717c9321..c4bc0c3a5414 100644
--- a/arch/x86/kernel/quirks.c
+++ b/arch/x86/kernel/quirks.c
@@ -4,6 +4,7 @@
  */
 #include <linux/dmi.h>
 #include <linux/pci.h>
+#include <linux/platform_data/x86/machine.h>
 #include <linux/irq.h>
 
 #include <asm/hpet.h>
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v1 2/3] x86/quirks: Introduce hpet_dev_print_force_hpet_address() helper
  2021-11-19 11:00 [PATCH v1 1/3] x86/quirks: Add missed include to satisfy static checker Andy Shevchenko
@ 2021-11-19 11:00 ` Andy Shevchenko
  2021-11-19 11:20   ` Joe Perches
  2021-11-19 18:35   ` Bjorn Helgaas
  2021-11-19 11:00 ` [PATCH v1 3/3] x86/quirks: Join string literals back Andy Shevchenko
  1 sibling, 2 replies; 5+ messages in thread
From: Andy Shevchenko @ 2021-11-19 11:00 UTC (permalink / raw)
  To: linux-pci, linux-kernel
  Cc: Bjorn Helgaas, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin, Andy Shevchenko

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);
+}
+
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v1 3/3] x86/quirks: Join string literals back
  2021-11-19 11:00 [PATCH v1 1/3] x86/quirks: Add missed include to satisfy static checker Andy Shevchenko
  2021-11-19 11:00 ` [PATCH v1 2/3] x86/quirks: Introduce hpet_dev_print_force_hpet_address() helper Andy Shevchenko
@ 2021-11-19 11:00 ` Andy Shevchenko
  1 sibling, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2021-11-19 11:00 UTC (permalink / raw)
  To: linux-pci, linux-kernel
  Cc: Bjorn Helgaas, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin, Andy Shevchenko

There is no need to split string literals. Moreover, it would be simpler
to grep for an actual code line, when debugging, by using almost any
part of the string literal in question.

No functional change intended.

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

diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c
index 7280125aed4d..9db1702d493d 100644
--- a/arch/x86/kernel/quirks.c
+++ b/arch/x86/kernel/quirks.c
@@ -36,8 +36,7 @@ static void quirk_intel_irqbalance(struct pci_dev *dev)
 	pci_bus_read_config_word(dev->bus, PCI_DEVFN(8, 0), 0x4c, &word);
 
 	if (!(word & (1 << 13))) {
-		dev_info(&dev->dev, "Intel E7520/7320/7525 detected; "
-			"disabling irq balancing and affinity\n");
+		dev_info(&dev->dev, "Intel E7520/7320/7525 detected; disabling irq balancing and affinity\n");
 		noirqdebug_setup("");
 #ifdef CONFIG_PROC_FS
 		no_irq_affinity = 1;
@@ -110,16 +109,14 @@ static void ich_force_enable_hpet(struct pci_dev *dev)
 	pci_read_config_dword(dev, 0xF0, &rcba);
 	rcba &= 0xFFFFC000;
 	if (rcba == 0) {
-		dev_printk(KERN_DEBUG, &dev->dev, "RCBA disabled; "
-			"cannot force enable HPET\n");
+		dev_printk(KERN_DEBUG, &dev->dev, "RCBA disabled; cannot force enable HPET\n");
 		return;
 	}
 
 	/* use bits 31:14, 16 kB aligned */
 	rcba_base = ioremap(rcba, 0x4000);
 	if (rcba_base == NULL) {
-		dev_printk(KERN_DEBUG, &dev->dev, "ioremap failed; "
-			"cannot force enable HPET\n");
+		dev_printk(KERN_DEBUG, &dev->dev, "ioremap failed; cannot force enable HPET\n");
 		return;
 	}
 
@@ -149,8 +146,7 @@ static void ich_force_enable_hpet(struct pci_dev *dev)
 	if (err) {
 		force_hpet_address = 0;
 		iounmap(rcba_base);
-		dev_printk(KERN_DEBUG, &dev->dev,
-			"Failed to force enable HPET\n");
+		dev_printk(KERN_DEBUG, &dev->dev, "Failed to force enable HPET\n");
 	} else {
 		force_hpet_resume_type = ICH_FORCE_HPET_RESUME;
 		hpet_dev_print_force_hpet_address(&dev->dev);
@@ -182,8 +178,7 @@ static struct pci_dev *cached_dev;
 
 static void hpet_print_force_info(void)
 {
-	printk(KERN_INFO "HPET not enabled in BIOS. "
-	       "You might try hpet=force boot option\n");
+	printk(KERN_INFO "HPET not enabled in BIOS. You might try hpet=force boot option\n");
 }
 
 static void old_ich_force_hpet_resume(void)
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 2/3] x86/quirks: Introduce hpet_dev_print_force_hpet_address() helper
  2021-11-19 11:00 ` [PATCH v1 2/3] x86/quirks: Introduce hpet_dev_print_force_hpet_address() helper Andy Shevchenko
@ 2021-11-19 11:20   ` Joe Perches
  2021-11-19 18:35   ` Bjorn Helgaas
  1 sibling, 0 replies; 5+ messages in thread
From: Joe Perches @ 2021-11-19 11:20 UTC (permalink / raw)
  To: Andy Shevchenko, linux-pci, linux-kernel
  Cc: Bjorn Helgaas, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin

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;



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 2/3] x86/quirks: Introduce hpet_dev_print_force_hpet_address() helper
  2021-11-19 11:00 ` [PATCH v1 2/3] x86/quirks: Introduce hpet_dev_print_force_hpet_address() helper Andy Shevchenko
  2021-11-19 11:20   ` Joe Perches
@ 2021-11-19 18:35   ` Bjorn Helgaas
  1 sibling, 0 replies; 5+ messages in thread
From: Bjorn Helgaas @ 2021-11-19 18:35 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-pci, linux-kernel, Bjorn Helgaas, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, x86, H. Peter Anvin

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
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-11-19 18:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-19 11:00 [PATCH v1 1/3] x86/quirks: Add missed include to satisfy static checker Andy Shevchenko
2021-11-19 11:00 ` [PATCH v1 2/3] x86/quirks: Introduce hpet_dev_print_force_hpet_address() helper Andy Shevchenko
2021-11-19 11:20   ` Joe Perches
2021-11-19 18:35   ` Bjorn Helgaas
2021-11-19 11:00 ` [PATCH v1 3/3] x86/quirks: Join string literals back Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).