linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Winkler, Tomas" <tomas.winkler@intel.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	"arnd@arndb.de" <arnd@arndb.de>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>,
	"Usyskin, Alexander" <alexander.usyskin@intel.com>
Subject: RE: [PATCH] mei: me: Use dma_set_mask_and_coherent() and simplify code
Date: Sun, 9 Jan 2022 06:05:35 +0000	[thread overview]
Message-ID: <210864289c574c65b1c7e5ad5b913b9c@intel.com> (raw)
In-Reply-To: <67ddcec656194153830684e6ff4513114e8859d6.1641624544.git.christophe.jaillet@wanadoo.fr>


> 
> Use dma_set_mask_and_coherent() instead of unrolling it with some
> dma_set_mask()+dma_set_coherent_mask().
> 
> Moreover, as stated in [1], dma_set_mask() with a 64-bit mask will never fail
> 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.
> 
> 
> While at it, include directly <linux/dma-mapping.h> instead on relying on
> indirect inclusion.
> 
> [1]: https://lkml.org/lkml/2021/6/7/398
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Tomas Winkler <tomas.winkler@intel.com>
> ---
>  drivers/misc/mei/pci-me.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c index
> 3a45aaf002ac..a05cdb25d0c4 100644
> --- a/drivers/misc/mei/pci-me.c
> +++ b/drivers/misc/mei/pci-me.c
> @@ -10,6 +10,7 @@
>  #include <linux/errno.h>
>  #include <linux/types.h>
>  #include <linux/pci.h>
> +#include <linux/dma-mapping.h>
>  #include <linux/sched.h>
>  #include <linux/interrupt.h>
> 
> @@ -192,14 +193,7 @@ static int mei_me_probe(struct pci_dev *pdev,
> const struct pci_device_id *ent)
>  		goto end;
>  	}
> 
> -	if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)) ||
> -	    dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64))) {
> -
> -		err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
> -		if (err)
> -			err = dma_set_coherent_mask(&pdev->dev,
> -						    DMA_BIT_MASK(32));
> -	}
> +	err = dma_set_mask_and_coherent(&pdev->dev,
> DMA_BIT_MASK(64));
>  	if (err) {
>  		dev_err(&pdev->dev, "No usable DMA configuration,
> aborting\n");
>  		goto end;
> --
> 2.32.0


      reply	other threads:[~2022-01-09  6:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-08  6:50 [PATCH] mei: me: Use dma_set_mask_and_coherent() and simplify code Christophe JAILLET
2022-01-09  6:05 ` Winkler, Tomas [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=210864289c574c65b1c7e5ad5b913b9c@intel.com \
    --to=tomas.winkler@intel.com \
    --cc=alexander.usyskin@intel.com \
    --cc=arnd@arndb.de \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).