All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 3/3] platform/x86: intel_speed_select_if: Remove hardcoded map size
@ 2023-09-26 17:53 Srinivas Pandruvada
  2023-09-26 19:19 ` Andy Shevchenko
  2023-09-29 14:21 ` Ilpo Järvinen
  0 siblings, 2 replies; 3+ messages in thread
From: Srinivas Pandruvada @ 2023-09-26 17:53 UTC (permalink / raw)
  To: hdegoede, markgross, ilpo.jarvinen, andriy.shevchenko
  Cc: platform-driver-x86, linux-kernel, Srinivas Pandruvada

The driver is using 256 as the size while calling devm_ioremap(). The
maximum offset can be obtained from isst_mmio_range. Add a field "size"
to the isst_mmio_range and use it instead of hardcoding.

No functional impact is expected.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
Changes:
As per Andy's comments pre calculate size

 .../x86/intel/speed_select_if/isst_if_mmio.c     | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c b/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c
index ff49025ec085..13e068c77d50 100644
--- a/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c
+++ b/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c
@@ -18,16 +18,17 @@
 struct isst_mmio_range {
 	int beg;
 	int end;
+	int size;
 };
 
 static struct isst_mmio_range mmio_range_devid_0[] = {
-	{0x04, 0x14},
-	{0x20, 0xD0},
+	{0x04, 0x14, 0x18},
+	{0x20, 0xD0, 0xD4},
 };
 
 static struct isst_mmio_range mmio_range_devid_1[] = {
-	{0x04, 0x14},
-	{0x20, 0x11C},
+	{0x04, 0x14, 0x18},
+	{0x20, 0x11C, 0x120},
 };
 
 struct isst_if_device {
@@ -114,13 +115,16 @@ static int isst_if_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	pcu_base &= GENMASK(10, 0);
 	base_addr = (u64)mmio_base << 23 | (u64) pcu_base << 12;
-	punit_dev->punit_mmio = devm_ioremap(&pdev->dev, base_addr, 256);
+
+	punit_dev->mmio_range = (struct isst_mmio_range *) ent->driver_data;
+
+	punit_dev->punit_mmio = devm_ioremap(&pdev->dev, base_addr,
+					     punit_dev->mmio_range[1].size);
 	if (!punit_dev->punit_mmio)
 		return -ENOMEM;
 
 	mutex_init(&punit_dev->mutex);
 	pci_set_drvdata(pdev, punit_dev);
-	punit_dev->mmio_range = (struct isst_mmio_range *) ent->driver_data;
 
 	memset(&cb, 0, sizeof(cb));
 	cb.cmd_size = sizeof(struct isst_if_io_reg);
-- 
2.41.0


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

* Re: [PATCH v2 3/3] platform/x86: intel_speed_select_if: Remove hardcoded map size
  2023-09-26 17:53 [PATCH v2 3/3] platform/x86: intel_speed_select_if: Remove hardcoded map size Srinivas Pandruvada
@ 2023-09-26 19:19 ` Andy Shevchenko
  2023-09-29 14:21 ` Ilpo Järvinen
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2023-09-26 19:19 UTC (permalink / raw)
  To: Srinivas Pandruvada
  Cc: hdegoede, markgross, ilpo.jarvinen, platform-driver-x86, linux-kernel

On Tue, Sep 26, 2023 at 10:53:49AM -0700, Srinivas Pandruvada wrote:
> The driver is using 256 as the size while calling devm_ioremap(). The
> maximum offset can be obtained from isst_mmio_range. Add a field "size"
> to the isst_mmio_range and use it instead of hardcoding.
> 
> No functional impact is expected.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v2 3/3] platform/x86: intel_speed_select_if: Remove hardcoded map size
  2023-09-26 17:53 [PATCH v2 3/3] platform/x86: intel_speed_select_if: Remove hardcoded map size Srinivas Pandruvada
  2023-09-26 19:19 ` Andy Shevchenko
@ 2023-09-29 14:21 ` Ilpo Järvinen
  1 sibling, 0 replies; 3+ messages in thread
From: Ilpo Järvinen @ 2023-09-29 14:21 UTC (permalink / raw)
  To: Srinivas Pandruvada
  Cc: Hans de Goede, markgross, Andy Shevchenko, platform-driver-x86, LKML

[-- Attachment #1: Type: text/plain, Size: 2126 bytes --]

On Tue, 26 Sep 2023, Srinivas Pandruvada wrote:

> The driver is using 256 as the size while calling devm_ioremap(). The
> maximum offset can be obtained from isst_mmio_range. Add a field "size"
> to the isst_mmio_range and use it instead of hardcoding.
> 
> No functional impact is expected.
> 
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> ---
> Changes:
> As per Andy's comments pre calculate size
> 
>  .../x86/intel/speed_select_if/isst_if_mmio.c     | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c b/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c
> index ff49025ec085..13e068c77d50 100644
> --- a/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c
> +++ b/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c
> @@ -18,16 +18,17 @@
>  struct isst_mmio_range {
>  	int beg;
>  	int end;
> +	int size;
>  };
>  
>  static struct isst_mmio_range mmio_range_devid_0[] = {
> -	{0x04, 0x14},
> -	{0x20, 0xD0},
> +	{0x04, 0x14, 0x18},
> +	{0x20, 0xD0, 0xD4},
>  };
>  
>  static struct isst_mmio_range mmio_range_devid_1[] = {
> -	{0x04, 0x14},
> -	{0x20, 0x11C},
> +	{0x04, 0x14, 0x18},
> +	{0x20, 0x11C, 0x120},
>  };
>  
>  struct isst_if_device {
> @@ -114,13 +115,16 @@ static int isst_if_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>  
>  	pcu_base &= GENMASK(10, 0);
>  	base_addr = (u64)mmio_base << 23 | (u64) pcu_base << 12;
> -	punit_dev->punit_mmio = devm_ioremap(&pdev->dev, base_addr, 256);
> +
> +	punit_dev->mmio_range = (struct isst_mmio_range *) ent->driver_data;
> +
> +	punit_dev->punit_mmio = devm_ioremap(&pdev->dev, base_addr,
> +					     punit_dev->mmio_range[1].size);
>  	if (!punit_dev->punit_mmio)
>  		return -ENOMEM;
>  
>  	mutex_init(&punit_dev->mutex);
>  	pci_set_drvdata(pdev, punit_dev);
> -	punit_dev->mmio_range = (struct isst_mmio_range *) ent->driver_data;
>  
>  	memset(&cb, 0, sizeof(cb));
>  	cb.cmd_size = sizeof(struct isst_if_io_reg);
> 

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

-- 
 i.

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

end of thread, other threads:[~2023-09-29 14:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-26 17:53 [PATCH v2 3/3] platform/x86: intel_speed_select_if: Remove hardcoded map size Srinivas Pandruvada
2023-09-26 19:19 ` Andy Shevchenko
2023-09-29 14:21 ` Ilpo Järvinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.