All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] HID: amd_sfh: Remove useless DMA-32 fallback configuration
@ 2022-01-15 15:24 Christophe JAILLET
  2022-01-17  9:34 ` Basavaraj Natikar
  2022-01-24  8:16 ` Jiri Kosina
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2022-01-15 15:24 UTC (permalink / raw)
  To: Nehal Shah, Basavaraj Natikar, Jiri Kosina, Benjamin Tissoires
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-input

As stated in [1], dma_set_mask() with a 64-bit mask never fails if
dev->dma_mask is non-NULL.
So, if it fails, the 32 bits case will also fail for the same reason.

Simplify code and remove some dead code accordingly.

[1]: https://lore.kernel.org/linux-kernel/YL3vSPK5DXTNvgdx@infradead.org/#t

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
index 2503be0253d3..673536d1d9ba 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
@@ -248,11 +248,8 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
 	pci_set_master(pdev);
 	rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
 	if (rc) {
-		rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
-		if (rc) {
-			dev_err(&pdev->dev, "failed to set DMA mask\n");
-			return rc;
-		}
+		dev_err(&pdev->dev, "failed to set DMA mask\n");
+		return rc;
 	}
 
 	privdata->cl_data = devm_kzalloc(&pdev->dev, sizeof(struct amdtp_cl_data), GFP_KERNEL);
-- 
2.32.0


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

* Re: [PATCH] HID: amd_sfh: Remove useless DMA-32 fallback configuration
  2022-01-15 15:24 [PATCH] HID: amd_sfh: Remove useless DMA-32 fallback configuration Christophe JAILLET
@ 2022-01-17  9:34 ` Basavaraj Natikar
  2022-01-24  8:16 ` Jiri Kosina
  1 sibling, 0 replies; 3+ messages in thread
From: Basavaraj Natikar @ 2022-01-17  9:34 UTC (permalink / raw)
  To: Christophe JAILLET, Nehal Shah, Basavaraj Natikar, Jiri Kosina,
	Benjamin Tissoires
  Cc: linux-kernel, kernel-janitors, linux-input


On 1/15/2022 8:54 PM, Christophe JAILLET wrote:
> As stated in [1], dma_set_mask() with a 64-bit mask never fails if
> dev->dma_mask is non-NULL.
> So, if it fails, the 32 bits case will also fail for the same reason.
>
> Simplify code and remove some dead code accordingly.
>
> [1]: https://lore.kernel.org/linux-kernel/YL3vSPK5DXTNvgdx@infradead.org/#t
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
> index 2503be0253d3..673536d1d9ba 100644
> --- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
> +++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
> @@ -248,11 +248,8 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
>  	pci_set_master(pdev);
>  	rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
>  	if (rc) {
> -		rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> -		if (rc) {
> -			dev_err(&pdev->dev, "failed to set DMA mask\n");
> -			return rc;
> -		}
> +		dev_err(&pdev->dev, "failed to set DMA mask\n");
> +		return rc;
>  	}
>  
>  	privdata->cl_data = devm_kzalloc(&pdev->dev, sizeof(struct amdtp_cl_data), GFP_KERNEL);

Acked-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>

Thanks,
Basavaraj


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

* Re: [PATCH] HID: amd_sfh: Remove useless DMA-32 fallback configuration
  2022-01-15 15:24 [PATCH] HID: amd_sfh: Remove useless DMA-32 fallback configuration Christophe JAILLET
  2022-01-17  9:34 ` Basavaraj Natikar
@ 2022-01-24  8:16 ` Jiri Kosina
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2022-01-24  8:16 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Nehal Shah, Basavaraj Natikar, Benjamin Tissoires, linux-kernel,
	kernel-janitors, linux-input

On Sat, 15 Jan 2022, Christophe JAILLET wrote:

> As stated in [1], dma_set_mask() with a 64-bit mask never fails if
> dev->dma_mask is non-NULL.
> So, if it fails, the 32 bits case will also fail for the same reason.
> 
> Simplify code and remove some dead code accordingly.
> 
> [1]: https://lore.kernel.org/linux-kernel/YL3vSPK5DXTNvgdx@infradead.org/#t
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
> index 2503be0253d3..673536d1d9ba 100644
> --- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
> +++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
> @@ -248,11 +248,8 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
>  	pci_set_master(pdev);
>  	rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
>  	if (rc) {
> -		rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> -		if (rc) {
> -			dev_err(&pdev->dev, "failed to set DMA mask\n");
> -			return rc;
> -		}
> +		dev_err(&pdev->dev, "failed to set DMA mask\n");
> +		return rc;
>  	}

Applied, thank you.

-- 
Jiri Kosina
SUSE Labs


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

end of thread, other threads:[~2022-01-24  8:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-15 15:24 [PATCH] HID: amd_sfh: Remove useless DMA-32 fallback configuration Christophe JAILLET
2022-01-17  9:34 ` Basavaraj Natikar
2022-01-24  8:16 ` Jiri Kosina

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.