[PATCH/RFC,v10,07/19] mfd: max77693: Adjust FLASH_EN_SHIFT and TORCH_EN_SHIFT macros

Message ID 1420816989-1808-8-git-send-email-j.anaszewski@samsung.com (mailing list archive)
State RFC, archived
Headers

Commit Message

Jacek Anaszewski Jan. 9, 2015, 3:22 p.m. UTC
  Modify FLASH_EN_SHIFT and TORCH_EN_SHIFT macros to work properly
when passed enum max77693_fled values (0 for FLED1 and 1 for FLED2)
from leds-max77693 driver.

Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Chanwoo Choi <cw00.choi@samsung.com>
Cc: Lee Jones <lee.jones@linaro.org>
---
 include/linux/mfd/max77693-private.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Pavel Machek Jan. 9, 2015, 5:59 p.m. UTC | #1
On Fri 2015-01-09 16:22:57, Jacek Anaszewski wrote:
> Modify FLASH_EN_SHIFT and TORCH_EN_SHIFT macros to work properly
> when passed enum max77693_fled values (0 for FLED1 and 1 for FLED2)
> from leds-max77693 driver.
> 
> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
> Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
> Cc: Chanwoo Choi <cw00.choi@samsung.com>
> Cc: Lee Jones <lee.jones@linaro.org>

Acked-by: Pavel Machek <pavel@ucw.cz>
  
Lee Jones Jan. 20, 2015, 11:17 a.m. UTC | #2
On Fri, 09 Jan 2015, Jacek Anaszewski wrote:

> Modify FLASH_EN_SHIFT and TORCH_EN_SHIFT macros to work properly
> when passed enum max77693_fled values (0 for FLED1 and 1 for FLED2)
> from leds-max77693 driver.

Off-by-one ay?  Wasn't the original code tested?

> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
> Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
> Cc: Chanwoo Choi <cw00.choi@samsung.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> ---
>  include/linux/mfd/max77693-private.h |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
> index 08dae01..01799a9 100644
> --- a/include/linux/mfd/max77693-private.h
> +++ b/include/linux/mfd/max77693-private.h
> @@ -113,8 +113,8 @@ enum max77693_pmic_reg {
>  #define FLASH_EN_FLASH		0x1
>  #define FLASH_EN_TORCH		0x2
>  #define FLASH_EN_ON		0x3
> -#define FLASH_EN_SHIFT(x)	(6 - ((x) - 1) * 2)
> -#define TORCH_EN_SHIFT(x)	(2 - ((x) - 1) * 2)
> +#define FLASH_EN_SHIFT(x)	(6 - (x) * 2)
> +#define TORCH_EN_SHIFT(x)	(2 - (x) * 2)
>  
>  /* MAX77693 MAX_FLASH1 register */
>  #define MAX_FLASH1_MAX_FL_EN	0x80
  
Jacek Anaszewski Jan. 20, 2015, 1:01 p.m. UTC | #3
On 01/20/2015 12:17 PM, Lee Jones wrote:
> On Fri, 09 Jan 2015, Jacek Anaszewski wrote:
>
>> Modify FLASH_EN_SHIFT and TORCH_EN_SHIFT macros to work properly
>> when passed enum max77693_fled values (0 for FLED1 and 1 for FLED2)
>> from leds-max77693 driver.
>
> Off-by-one ay?  Wasn't the original code tested?

The driver using these macros is a part of LED / flash API integration
patch series, which still undergoes modifications and it hasn't
reached its final state yet, as there are many things to discuss.

>> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
>> Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
>> Cc: Chanwoo Choi <cw00.choi@samsung.com>
>> Cc: Lee Jones <lee.jones@linaro.org>
>> ---
>>   include/linux/mfd/max77693-private.h |    4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
>> index 08dae01..01799a9 100644
>> --- a/include/linux/mfd/max77693-private.h
>> +++ b/include/linux/mfd/max77693-private.h
>> @@ -113,8 +113,8 @@ enum max77693_pmic_reg {
>>   #define FLASH_EN_FLASH		0x1
>>   #define FLASH_EN_TORCH		0x2
>>   #define FLASH_EN_ON		0x3
>> -#define FLASH_EN_SHIFT(x)	(6 - ((x) - 1) * 2)
>> -#define TORCH_EN_SHIFT(x)	(2 - ((x) - 1) * 2)
>> +#define FLASH_EN_SHIFT(x)	(6 - (x) * 2)
>> +#define TORCH_EN_SHIFT(x)	(2 - (x) * 2)
>>
>>   /* MAX77693 MAX_FLASH1 register */
>>   #define MAX_FLASH1_MAX_FL_EN	0x80
>
  
Jacek Anaszewski Jan. 20, 2015, 2:11 p.m. UTC | #4
On 01/20/2015 02:01 PM, Jacek Anaszewski wrote:
> On 01/20/2015 12:17 PM, Lee Jones wrote:
>> On Fri, 09 Jan 2015, Jacek Anaszewski wrote:
>>
>>> Modify FLASH_EN_SHIFT and TORCH_EN_SHIFT macros to work properly
>>> when passed enum max77693_fled values (0 for FLED1 and 1 for FLED2)
>>> from leds-max77693 driver.
>>
>> Off-by-one ay?  Wasn't the original code tested?
>
> The driver using these macros is a part of LED / flash API integration
> patch series, which still undergoes modifications and it hasn't
> reached its final state yet, as there are many things to discuss.

To be more precise: the original code had been tested and was working
properly with the header that is in the mainline. Nonetheless, because
of the modifications in the driver that was requested during code
review, it turned out that it would be more convenient to redefine the
macros.

I'd opt for just agreeing about the mfd related patches and merge
them no sooner than the leds-max77693 driver is merged.
  
Lee Jones Jan. 20, 2015, 3:40 p.m. UTC | #5
On Tue, 20 Jan 2015, Jacek Anaszewski wrote:

> On 01/20/2015 02:01 PM, Jacek Anaszewski wrote:
> >On 01/20/2015 12:17 PM, Lee Jones wrote:
> >>On Fri, 09 Jan 2015, Jacek Anaszewski wrote:
> >>
> >>>Modify FLASH_EN_SHIFT and TORCH_EN_SHIFT macros to work properly
> >>>when passed enum max77693_fled values (0 for FLED1 and 1 for FLED2)
> >>>from leds-max77693 driver.
> >>
> >>Off-by-one ay?  Wasn't the original code tested?
> >
> >The driver using these macros is a part of LED / flash API integration
> >patch series, which still undergoes modifications and it hasn't
> >reached its final state yet, as there are many things to discuss.
> 
> To be more precise: the original code had been tested and was working
> properly with the header that is in the mainline. Nonetheless, because
> of the modifications in the driver that was requested during code
> review, it turned out that it would be more convenient to redefine the
> macros.
> 
> I'd opt for just agreeing about the mfd related patches and merge
> them no sooner than the leds-max77693 driver is merged.

The only way we can guarantee this is to have them go in during
different merge-windows, unless of course they go in via the same tree.
  
Pavel Machek Jan. 20, 2015, 4 p.m. UTC | #6
On Tue 2015-01-20 15:40:29, Lee Jones wrote:
> On Tue, 20 Jan 2015, Jacek Anaszewski wrote:
> 
> > On 01/20/2015 02:01 PM, Jacek Anaszewski wrote:
> > >On 01/20/2015 12:17 PM, Lee Jones wrote:
> > >>On Fri, 09 Jan 2015, Jacek Anaszewski wrote:
> > >>
> > >>>Modify FLASH_EN_SHIFT and TORCH_EN_SHIFT macros to work properly
> > >>>when passed enum max77693_fled values (0 for FLED1 and 1 for FLED2)
> > >>>from leds-max77693 driver.
> > >>
> > >>Off-by-one ay?  Wasn't the original code tested?
> > >
> > >The driver using these macros is a part of LED / flash API integration
> > >patch series, which still undergoes modifications and it hasn't
> > >reached its final state yet, as there are many things to discuss.
> > 
> > To be more precise: the original code had been tested and was working
> > properly with the header that is in the mainline. Nonetheless, because
> > of the modifications in the driver that was requested during code
> > review, it turned out that it would be more convenient to redefine the
> > macros.
> > 
> > I'd opt for just agreeing about the mfd related patches and merge
> > them no sooner than the leds-max77693 driver is merged.
> 
> The only way we can guarantee this is to have them go in during
> different merge-windows, unless of course they go in via the same tree.

Umm. Maintainers should be able to coordinate that. Delaying patch for
one major release seems rather cruel. Perhaps one maintainer should
ack the patch and the second one should merge it...
									Pavel
  
Lee Jones Jan. 20, 2015, 4:41 p.m. UTC | #7
On Tue, 20 Jan 2015, Pavel Machek wrote:
> On Tue 2015-01-20 15:40:29, Lee Jones wrote:
> > On Tue, 20 Jan 2015, Jacek Anaszewski wrote:
> > 
> > > On 01/20/2015 02:01 PM, Jacek Anaszewski wrote:
> > > >On 01/20/2015 12:17 PM, Lee Jones wrote:
> > > >>On Fri, 09 Jan 2015, Jacek Anaszewski wrote:
> > > >>
> > > >>>Modify FLASH_EN_SHIFT and TORCH_EN_SHIFT macros to work properly
> > > >>>when passed enum max77693_fled values (0 for FLED1 and 1 for FLED2)
> > > >>>from leds-max77693 driver.
> > > >>
> > > >>Off-by-one ay?  Wasn't the original code tested?
> > > >
> > > >The driver using these macros is a part of LED / flash API integration
> > > >patch series, which still undergoes modifications and it hasn't
> > > >reached its final state yet, as there are many things to discuss.
> > > 
> > > To be more precise: the original code had been tested and was working
> > > properly with the header that is in the mainline. Nonetheless, because
> > > of the modifications in the driver that was requested during code
> > > review, it turned out that it would be more convenient to redefine the
> > > macros.
> > > 
> > > I'd opt for just agreeing about the mfd related patches and merge
> > > them no sooner than the leds-max77693 driver is merged.
> > 
> > The only way we can guarantee this is to have them go in during
> > different merge-windows, unless of course they go in via the same tree.
> 
> Umm. Maintainers should be able to coordinate that. Delaying patch for
> one major release seems rather cruel. Perhaps one maintainer should
> ack the patch and the second one should merge it...

Wow, you're just everywhere today. :)

Read the part after the comma again.
  

Patch

diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
index 08dae01..01799a9 100644
--- a/include/linux/mfd/max77693-private.h
+++ b/include/linux/mfd/max77693-private.h
@@ -113,8 +113,8 @@  enum max77693_pmic_reg {
 #define FLASH_EN_FLASH		0x1
 #define FLASH_EN_TORCH		0x2
 #define FLASH_EN_ON		0x3
-#define FLASH_EN_SHIFT(x)	(6 - ((x) - 1) * 2)
-#define TORCH_EN_SHIFT(x)	(2 - ((x) - 1) * 2)
+#define FLASH_EN_SHIFT(x)	(6 - (x) * 2)
+#define TORCH_EN_SHIFT(x)	(2 - (x) * 2)
 
 /* MAX77693 MAX_FLASH1 register */
 #define MAX_FLASH1_MAX_FL_EN	0x80