linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: buffer: re-introduce bitmap_zalloc() for trialmask
@ 2020-03-17 12:36 Alexandru Ardelean
  2020-03-17 12:52 ` Andy Shevchenko
  2020-03-21  8:59 ` [PATCH v2] " Alexandru Ardelean
  0 siblings, 2 replies; 7+ messages in thread
From: Alexandru Ardelean @ 2020-03-17 12:36 UTC (permalink / raw)
  To: linux-iio, linux-kernel
  Cc: jic23, andriy.shevchenko, lars, Alexandru Ardelean

Commit 3862828a903d3 ("iio: buffer: Switch to bitmap_zalloc()") introduced
bitmap_alloc(), but commit 20ea39ef9f2f9 ("iio: Fix scan mask selection")
reverted it.

This change adds it back. The only difference is that it's adding
bitmap_zalloc(). There might be some changes later that would require
initializing it to zero. In any case, now it's already zero-ing the
trialmask.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
 drivers/iio/industrialio-buffer.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index 4ada5592aa2b..5ff34ce8b6a2 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -316,8 +316,7 @@ static int iio_scan_mask_set(struct iio_dev *indio_dev,
 	const unsigned long *mask;
 	unsigned long *trialmask;
 
-	trialmask = kcalloc(BITS_TO_LONGS(indio_dev->masklength),
-			    sizeof(*trialmask), GFP_KERNEL);
+	trialmask = bitmap_zalloc(indio_dev->masklength, GFP_KERNEL);
 	if (trialmask == NULL)
 		return -ENOMEM;
 	if (!indio_dev->masklength) {
-- 
2.20.1


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

* Re: [PATCH] iio: buffer: re-introduce bitmap_zalloc() for trialmask
  2020-03-17 12:36 [PATCH] iio: buffer: re-introduce bitmap_zalloc() for trialmask Alexandru Ardelean
@ 2020-03-17 12:52 ` Andy Shevchenko
  2020-03-17 12:53   ` Ardelean, Alexandru
  2020-03-21  8:59 ` [PATCH v2] " Alexandru Ardelean
  1 sibling, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2020-03-17 12:52 UTC (permalink / raw)
  To: Alexandru Ardelean
  Cc: linux-iio, linux-kernel, jic23, lars, Alexandru Ardelean

On Tue, Mar 17, 2020 at 02:36:21PM +0200, Alexandru Ardelean wrote:
> Commit 3862828a903d3 ("iio: buffer: Switch to bitmap_zalloc()") introduced
> bitmap_alloc(), but commit 20ea39ef9f2f9 ("iio: Fix scan mask selection")
> reverted it.
> 
> This change adds it back. The only difference is that it's adding
> bitmap_zalloc(). There might be some changes later that would require
> initializing it to zero. In any case, now it's already zero-ing the
> trialmask.

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

> 
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> ---
>  drivers/iio/industrialio-buffer.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
> index 4ada5592aa2b..5ff34ce8b6a2 100644
> --- a/drivers/iio/industrialio-buffer.c
> +++ b/drivers/iio/industrialio-buffer.c
> @@ -316,8 +316,7 @@ static int iio_scan_mask_set(struct iio_dev *indio_dev,
>  	const unsigned long *mask;
>  	unsigned long *trialmask;
>  
> -	trialmask = kcalloc(BITS_TO_LONGS(indio_dev->masklength),
> -			    sizeof(*trialmask), GFP_KERNEL);
> +	trialmask = bitmap_zalloc(indio_dev->masklength, GFP_KERNEL);
>  	if (trialmask == NULL)
>  		return -ENOMEM;
>  	if (!indio_dev->masklength) {
> -- 
> 2.20.1
> 

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH] iio: buffer: re-introduce bitmap_zalloc() for trialmask
  2020-03-17 12:52 ` Andy Shevchenko
@ 2020-03-17 12:53   ` Ardelean, Alexandru
  2020-03-17 13:18     ` Lars-Peter Clausen
  0 siblings, 1 reply; 7+ messages in thread
From: Ardelean, Alexandru @ 2020-03-17 12:53 UTC (permalink / raw)
  To: ardeleanalex, andriy.shevchenko; +Cc: jic23, linux-kernel, linux-iio, lars

On Tue, 2020-03-17 at 14:52 +0200, Andy Shevchenko wrote:
> [External]
> 
> On Tue, Mar 17, 2020 at 02:36:21PM +0200, Alexandru Ardelean wrote:
> > Commit 3862828a903d3 ("iio: buffer: Switch to bitmap_zalloc()") introduced
> > bitmap_alloc(), but commit 20ea39ef9f2f9 ("iio: Fix scan mask selection")
> > reverted it.
> > 
> > This change adds it back. The only difference is that it's adding
> > bitmap_zalloc(). There might be some changes later that would require
> > initializing it to zero. In any case, now it's already zero-ing the
> > trialmask.
> 
> FWIW,
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thanks.
And sorry for the hiccup back there.

> 
> > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> > ---
> >  drivers/iio/industrialio-buffer.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-
> > buffer.c
> > index 4ada5592aa2b..5ff34ce8b6a2 100644
> > --- a/drivers/iio/industrialio-buffer.c
> > +++ b/drivers/iio/industrialio-buffer.c
> > @@ -316,8 +316,7 @@ static int iio_scan_mask_set(struct iio_dev *indio_dev,
> >  	const unsigned long *mask;
> >  	unsigned long *trialmask;
> >  
> > -	trialmask = kcalloc(BITS_TO_LONGS(indio_dev->masklength),
> > -			    sizeof(*trialmask), GFP_KERNEL);
> > +	trialmask = bitmap_zalloc(indio_dev->masklength, GFP_KERNEL);
> >  	if (trialmask == NULL)
> >  		return -ENOMEM;
> >  	if (!indio_dev->masklength) {
> > -- 
> > 2.20.1
> > 

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

* Re: [PATCH] iio: buffer: re-introduce bitmap_zalloc() for trialmask
  2020-03-17 12:53   ` Ardelean, Alexandru
@ 2020-03-17 13:18     ` Lars-Peter Clausen
  2020-03-22 17:02       ` Jonathan Cameron
  0 siblings, 1 reply; 7+ messages in thread
From: Lars-Peter Clausen @ 2020-03-17 13:18 UTC (permalink / raw)
  To: Ardelean, Alexandru, ardeleanalex, andriy.shevchenko
  Cc: jic23, linux-kernel, linux-iio

On 3/17/20 1:53 PM, Ardelean, Alexandru wrote:
> On Tue, 2020-03-17 at 14:52 +0200, Andy Shevchenko wrote:
>> [External]
>>
>> On Tue, Mar 17, 2020 at 02:36:21PM +0200, Alexandru Ardelean wrote:
>>> Commit 3862828a903d3 ("iio: buffer: Switch to bitmap_zalloc()") introduced
>>> bitmap_alloc(), but commit 20ea39ef9f2f9 ("iio: Fix scan mask selection")
>>> reverted it.
>>>
>>> This change adds it back. The only difference is that it's adding
>>> bitmap_zalloc(). There might be some changes later that would require
>>> initializing it to zero. In any case, now it's already zero-ing the
>>> trialmask.
>>
>> FWIW,
>> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> Thanks.
> And sorry for the hiccup back there.

It looks like a merge conflict. Both patches are in parallel sub-trees. 
I guess one went through fixes and the other through the normal tree and 
then when they were merged, the issue was not resolved properly.

2019-04-21 Greg Kroah-Hartman   M─┐ Merge 5.1-rc6 into staging-next
2019-02-20 Lars-Peter Clausen   │ o iio: Fix scan mask selection
2019-03-04 Andy Shevchenko      o │ iio: buffer: Switch to bitmap_zalloc
2018-02-20 Greg Kroah-Hartman   M─┤ Merge tag 'iio-fixes-for-4.16a

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

* [PATCH v2] iio: buffer: re-introduce bitmap_zalloc() for trialmask
  2020-03-17 12:36 [PATCH] iio: buffer: re-introduce bitmap_zalloc() for trialmask Alexandru Ardelean
  2020-03-17 12:52 ` Andy Shevchenko
@ 2020-03-21  8:59 ` Alexandru Ardelean
  2020-03-22 17:01   ` Jonathan Cameron
  1 sibling, 1 reply; 7+ messages in thread
From: Alexandru Ardelean @ 2020-03-21  8:59 UTC (permalink / raw)
  To: linux-iio, linux-kernel
  Cc: lars, andriy.shevchenko, jic23, Alexandru Ardelean

Commit 3862828a903d3 ("iio: buffer: Switch to bitmap_zalloc()") introduced
bitmap_alloc(), but commit 20ea39ef9f2f9 ("iio: Fix scan mask selection")
reverted it.

This change adds it back. The only difference is that it's adding
bitmap_zalloc(). There might be some changes later that would require
initializing it to zero. In any case, now it's already zero-ing the
trialmask.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---

Changelog v1 -> v2:
* add 'Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>' 
* re-send from an Analog server; GMail changed the author to @gmail.com

 drivers/iio/industrialio-buffer.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index 4ada5592aa2b..5ff34ce8b6a2 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -316,8 +316,7 @@ static int iio_scan_mask_set(struct iio_dev *indio_dev,
 	const unsigned long *mask;
 	unsigned long *trialmask;
 
-	trialmask = kcalloc(BITS_TO_LONGS(indio_dev->masklength),
-			    sizeof(*trialmask), GFP_KERNEL);
+	trialmask = bitmap_zalloc(indio_dev->masklength, GFP_KERNEL);
 	if (trialmask == NULL)
 		return -ENOMEM;
 	if (!indio_dev->masklength) {
-- 
2.17.1


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

* Re: [PATCH v2] iio: buffer: re-introduce bitmap_zalloc() for trialmask
  2020-03-21  8:59 ` [PATCH v2] " Alexandru Ardelean
@ 2020-03-22 17:01   ` Jonathan Cameron
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2020-03-22 17:01 UTC (permalink / raw)
  To: Alexandru Ardelean; +Cc: linux-iio, linux-kernel, lars, andriy.shevchenko

On Sat, 21 Mar 2020 10:59:56 +0200
Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:

> Commit 3862828a903d3 ("iio: buffer: Switch to bitmap_zalloc()") introduced
> bitmap_alloc(), but commit 20ea39ef9f2f9 ("iio: Fix scan mask selection")
> reverted it.
> 
> This change adds it back. The only difference is that it's adding
> bitmap_zalloc(). There might be some changes later that would require
> initializing it to zero. In any case, now it's already zero-ing the
> trialmask.
> 
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>

Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to poke it.

Thanks,

Jonathan
> ---
> 
> Changelog v1 -> v2:
> * add 'Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>' 
> * re-send from an Analog server; GMail changed the author to @gmail.com
> 
>  drivers/iio/industrialio-buffer.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
> index 4ada5592aa2b..5ff34ce8b6a2 100644
> --- a/drivers/iio/industrialio-buffer.c
> +++ b/drivers/iio/industrialio-buffer.c
> @@ -316,8 +316,7 @@ static int iio_scan_mask_set(struct iio_dev *indio_dev,
>  	const unsigned long *mask;
>  	unsigned long *trialmask;
>  
> -	trialmask = kcalloc(BITS_TO_LONGS(indio_dev->masklength),
> -			    sizeof(*trialmask), GFP_KERNEL);
> +	trialmask = bitmap_zalloc(indio_dev->masklength, GFP_KERNEL);
>  	if (trialmask == NULL)
>  		return -ENOMEM;
>  	if (!indio_dev->masklength) {


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

* Re: [PATCH] iio: buffer: re-introduce bitmap_zalloc() for trialmask
  2020-03-17 13:18     ` Lars-Peter Clausen
@ 2020-03-22 17:02       ` Jonathan Cameron
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2020-03-22 17:02 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Ardelean, Alexandru, ardeleanalex, andriy.shevchenko,
	linux-kernel, linux-iio

On Tue, 17 Mar 2020 14:18:43 +0100
Lars-Peter Clausen <lars@metafoo.de> wrote:

> On 3/17/20 1:53 PM, Ardelean, Alexandru wrote:
> > On Tue, 2020-03-17 at 14:52 +0200, Andy Shevchenko wrote:  
> >> [External]
> >>
> >> On Tue, Mar 17, 2020 at 02:36:21PM +0200, Alexandru Ardelean wrote:  
> >>> Commit 3862828a903d3 ("iio: buffer: Switch to bitmap_zalloc()") introduced
> >>> bitmap_alloc(), but commit 20ea39ef9f2f9 ("iio: Fix scan mask selection")
> >>> reverted it.
> >>>
> >>> This change adds it back. The only difference is that it's adding
> >>> bitmap_zalloc(). There might be some changes later that would require
> >>> initializing it to zero. In any case, now it's already zero-ing the
> >>> trialmask.  
> >>
> >> FWIW,
> >> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>  
> > 
> > Thanks.
> > And sorry for the hiccup back there.  
> 
> It looks like a merge conflict. Both patches are in parallel sub-trees. 
> I guess one went through fixes and the other through the normal tree and 
> then when they were merged, the issue was not resolved properly.
> 
> 2019-04-21 Greg Kroah-Hartman   M─┐ Merge 5.1-rc6 into staging-next
> 2019-02-20 Lars-Peter Clausen   │ o iio: Fix scan mask selection
> 2019-03-04 Andy Shevchenko      o │ iio: buffer: Switch to bitmap_zalloc
> 2018-02-20 Greg Kroah-Hartman   M─┤ Merge tag 'iio-fixes-for-4.16a

Thanks for the detective work. I've added a note to the patch description.

Jonathan

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

end of thread, other threads:[~2020-03-22 17:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-17 12:36 [PATCH] iio: buffer: re-introduce bitmap_zalloc() for trialmask Alexandru Ardelean
2020-03-17 12:52 ` Andy Shevchenko
2020-03-17 12:53   ` Ardelean, Alexandru
2020-03-17 13:18     ` Lars-Peter Clausen
2020-03-22 17:02       ` Jonathan Cameron
2020-03-21  8:59 ` [PATCH v2] " Alexandru Ardelean
2020-03-22 17:01   ` Jonathan Cameron

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).