[v1,00/12] HID: cp2112: Cleanups and refactorings

Message ID 20230703185222.50554-1-andriy.shevchenko@linux.intel.com
Headers
Series HID: cp2112: Cleanups and refactorings |

Message

Andy Shevchenko July 3, 2023, 6:52 p.m. UTC
  After I updated GPIO library for the case Benjamin has with CP2112,
I have a brief look into the CP2112 driver itself.

From GPIO perspective it has two main (maitenance) issues:
- usage of ->to_irq() with IRQ chip present;
- having IRQ chip not immutable.

Besides that there are plenty small cleanups here and there.
Hence this series.

Compile tested only.

Andy Shevchenko (12):
  lib/string_choices: Add str_write_read() helper
  HID: cp2112: Use str_write_read() and str_read_write()
  HID: cp2112: Make irq_chip immutable
  HID: cp2112: Switch to for_each_set_bit() to simplify the code
  HID: cp2112: Don't call ->to_irq() explicitly
  HID: cp2112: Remove dead code
  HID: cp2112: Define maximum GPIO constant and use it
  HID: cp2112: Define all GPIO mask and use it
  HID: cp2112: Use BIT() in GPIO setter and getter
  HID: cp2112: Use sysfs_emit() to instead of scnprintf()
  HID: cp2112: Convert to DEVICE_ATTR_RW()
  HID: cp2112: Use octal permissions

 drivers/hid/hid-cp2112.c       | 169 +++++++++++----------------------
 include/linux/string_choices.h |   1 +
 2 files changed, 58 insertions(+), 112 deletions(-)
  

Comments

Andy Shevchenko July 27, 2023, 6:43 p.m. UTC | #1
On Mon, Jul 03, 2023 at 09:52:10PM +0300, Andy Shevchenko wrote:
> After I updated GPIO library for the case Benjamin has with CP2112,
> I have a brief look into the CP2112 driver itself.
> 
> From GPIO perspective it has two main (maitenance) issues:
> - usage of ->to_irq() with IRQ chip present;
> - having IRQ chip not immutable.
> 
> Besides that there are plenty small cleanups here and there.
> Hence this series.

Any comments on this?
  
Andy Shevchenko Aug. 4, 2023, 6:40 a.m. UTC | #2
On Thu, Jul 27, 2023 at 09:43:29PM +0300, Andy Shevchenko wrote:
> On Mon, Jul 03, 2023 at 09:52:10PM +0300, Andy Shevchenko wrote:
> > After I updated GPIO library for the case Benjamin has with CP2112,
> > I have a brief look into the CP2112 driver itself.
> > 
> > From GPIO perspective it has two main (maitenance) issues:
> > - usage of ->to_irq() with IRQ chip present;
> > - having IRQ chip not immutable.
> > 
> > Besides that there are plenty small cleanups here and there.
> > Hence this series.
> 
> Any comments on this?

Gentle ping^2 for this...

Anything should I do to improve it or is it okay to go as is?
  
Jiri Kosina Aug. 7, 2023, 11:19 a.m. UTC | #3
On Fri, 4 Aug 2023, Andy Shevchenko wrote:

> On Thu, Jul 27, 2023 at 09:43:29PM +0300, Andy Shevchenko wrote:
> > On Mon, Jul 03, 2023 at 09:52:10PM +0300, Andy Shevchenko wrote:
> > > After I updated GPIO library for the case Benjamin has with CP2112,
> > > I have a brief look into the CP2112 driver itself.
> > > 
> > > From GPIO perspective it has two main (maitenance) issues:
> > > - usage of ->to_irq() with IRQ chip present;
> > > - having IRQ chip not immutable.
> > > 
> > > Besides that there are plenty small cleanups here and there.
> > > Hence this series.
> > 
> > Any comments on this?
> 
> Gentle ping^2 for this...
> 
> Anything should I do to improve it or is it okay to go as is?

I have been off pretty much the whole July. I am now back and slowly 
making my way through everything that accumulated, I will eventually get 
to this.

Thanks for the patience,
  
Andy Shevchenko Aug. 7, 2023, 2:30 p.m. UTC | #4
On Mon, Aug 07, 2023 at 01:19:54PM +0200, Jiri Kosina wrote:
> On Fri, 4 Aug 2023, Andy Shevchenko wrote:
> > On Thu, Jul 27, 2023 at 09:43:29PM +0300, Andy Shevchenko wrote:
> > > On Mon, Jul 03, 2023 at 09:52:10PM +0300, Andy Shevchenko wrote:
> > > > After I updated GPIO library for the case Benjamin has with CP2112,
> > > > I have a brief look into the CP2112 driver itself.
> > > > 
> > > > From GPIO perspective it has two main (maitenance) issues:
> > > > - usage of ->to_irq() with IRQ chip present;
> > > > - having IRQ chip not immutable.
> > > > 
> > > > Besides that there are plenty small cleanups here and there.
> > > > Hence this series.
> > > 
> > > Any comments on this?
> > 
> > Gentle ping^2 for this...
> > 
> > Anything should I do to improve it or is it okay to go as is?
> 
> I have been off pretty much the whole July. I am now back and slowly 
> making my way through everything that accumulated, I will eventually get 
> to this.
> 
> Thanks for the patience,

Ah, okay, no worries and take your time!

I was thinking more on Benjamin's answer as last time he had a hw setup
to test... Not sure what the status of that now and if he has a chance
to test this or busy enough with something else.
  
Jiri Kosina Aug. 14, 2023, 9:28 a.m. UTC | #5
On Mon, 7 Aug 2023, Andy Shevchenko wrote:

> > > > > After I updated GPIO library for the case Benjamin has with CP2112,
> > > > > I have a brief look into the CP2112 driver itself.
> > > > > 
> > > > > From GPIO perspective it has two main (maitenance) issues:
> > > > > - usage of ->to_irq() with IRQ chip present;
> > > > > - having IRQ chip not immutable.
> > > > > 
> > > > > Besides that there are plenty small cleanups here and there.
> > > > > Hence this series.
> > > > 
> > > > Any comments on this?
> > > 
> > > Gentle ping^2 for this...
> > > 
> > > Anything should I do to improve it or is it okay to go as is?
> > 
> > I have been off pretty much the whole July. I am now back and slowly 
> > making my way through everything that accumulated, I will eventually get 
> > to this.
> > 
> > Thanks for the patience,
> 
> Ah, okay, no worries and take your time!
> 
> I was thinking more on Benjamin's answer as last time he had a hw setup
> to test... Not sure what the status of that now and if he has a chance
> to test this or busy enough with something else.

Ah, that would be of course nice. Benjamin?

Thanks,
  
Benjamin Tissoires Aug. 21, 2023, 8:51 a.m. UTC | #6
On Aug 21 2023, Andy Shevchenko wrote:
> On Mon, Aug 14, 2023 at 11:28:58AM +0200, Jiri Kosina wrote:
> > On Mon, 7 Aug 2023, Andy Shevchenko wrote:
> 
> ...
> 
> > > > > > > After I updated GPIO library for the case Benjamin has with CP2112,
> > > > > > > I have a brief look into the CP2112 driver itself.
> > > > > > > 
> > > > > > > From GPIO perspective it has two main (maitenance) issues:
> > > > > > > - usage of ->to_irq() with IRQ chip present;
> > > > > > > - having IRQ chip not immutable.
> > > > > > > 
> > > > > > > Besides that there are plenty small cleanups here and there.
> > > > > > > Hence this series.
> > > > > > 
> > > > > > Any comments on this?
> > > > > 
> > > > > Gentle ping^2 for this...
> > > > > 
> > > > > Anything should I do to improve it or is it okay to go as is?
> > > > 
> > > > I have been off pretty much the whole July. I am now back and slowly 
> > > > making my way through everything that accumulated, I will eventually get 
> > > > to this.
> > > > 
> > > > Thanks for the patience,
> > > 
> > > Ah, okay, no worries and take your time!
> > > 
> > > I was thinking more on Benjamin's answer as last time he had a hw setup
> > > to test... Not sure what the status of that now and if he has a chance
> > > to test this or busy enough with something else.
> > 
> > Ah, that would be of course nice. Benjamin?
> 
> Benjamin? It almost full release cycle passed...
> I understand if you are busy with something, just tell us.

Sorry for not answering, I was off in August until just now.

I tried you series just before taking time off, but the problem was that
my automation relies on this driver to not be too far from the current
upstream, as I need to patch it to be able to inject a node child in it.

Which is why I was very interested in the ACPI/DT work so that I do not
have to patch the driver.

Long story short, I'm not able to test it right now (and I got quite
some backlog as you can imagine). IIRC the code was fine, so I think we
can just take the series as is, and work on the quirks (if any) later.

Cheers,
Benjamin