diff mbox series

[v2] i2c: Remove '-Wno-deprecated-declarations' compiler warning

Message ID 20180819135135.8801-1-sedat.dilek@credativ.de
State Accepted
Headers show
Series [v2] i2c: Remove '-Wno-deprecated-declarations' compiler warning | expand

Commit Message

Sedat Dilek Aug. 19, 2018, 1:51 p.m. UTC
This can be dropped with commit 771c035372a036f83353eef46dbb829780330234
("deprecate the '__deprecated' attribute warnings entirely and for good")
now in upstream.

Please, use the kbuild infrastruture to disable compiler warnings.
This should be...

CFLAGS_i2c-core-base.o := $(call cc-disable-warning, deprecated-declarations)

This has the advantage to check if other compilers like GCC support this.

NOTE: My compiler is a prerelease of LLVM/Clang version 7.

[1] https://clang.llvm.org/docs/DiagnosticsReference.html#wdeprecated-declarations

CC: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Sedat Dilek <sedat.dilek@credativ.de>
---
[ v2: Fix typo s/no-deprecated-declarations/deprecated-declarations. -dileks ]
 drivers/i2c/Makefile | 1 -
 1 file changed, 1 deletion(-)

Comments

kernel test robot Aug. 19, 2018, 3:23 p.m. UTC | #1
Hi Sedat,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on wsa/i2c/for-next]
[also build test WARNING on v4.18 next-20180817]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Sedat-Dilek/i2c-Remove-Wno-deprecated-declarations-compiler-warning/20180819-215230
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next
config: i386-randconfig-a0-201833 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers//i2c/i2c-core-base.c: In function 'i2c_do_add_adapter':
>> drivers//i2c/i2c-core-base.c:1128:2: warning: 'attach_adapter' is deprecated (declared at include/linux/i2c.h:274) [-Wdeprecated-declarations]
     if (driver->attach_adapter) {
     ^
   drivers//i2c/i2c-core-base.c:1134:3: warning: 'attach_adapter' is deprecated (declared at include/linux/i2c.h:274) [-Wdeprecated-declarations]
      driver->attach_adapter(adap);
      ^

vim +/attach_adapter +1128 drivers//i2c/i2c-core-base.c

9c1600ed drivers/i2c/i2c-core.c David Brownell  2007-05-01  1120  
69b0089a drivers/i2c/i2c-core.c Jean Delvare    2009-12-06  1121  static int i2c_do_add_adapter(struct i2c_driver *driver,
69b0089a drivers/i2c/i2c-core.c Jean Delvare    2009-12-06  1122  			      struct i2c_adapter *adap)
026526f5 drivers/i2c/i2c-core.c Jean Delvare    2008-01-27  1123  {
4735c98f drivers/i2c/i2c-core.c Jean Delvare    2008-07-14  1124  	/* Detect supported devices on that bus, and instantiate them */
4735c98f drivers/i2c/i2c-core.c Jean Delvare    2008-07-14  1125  	i2c_detect(adap, driver);
4735c98f drivers/i2c/i2c-core.c Jean Delvare    2008-07-14  1126  
4735c98f drivers/i2c/i2c-core.c Jean Delvare    2008-07-14  1127  	/* Let legacy drivers scan this bus for matching devices */
026526f5 drivers/i2c/i2c-core.c Jean Delvare    2008-01-27 @1128  	if (driver->attach_adapter) {
a920ff41 drivers/i2c/i2c-core.c Jean Delvare    2011-04-17  1129  		dev_warn(&adap->dev, "%s: attach_adapter method is deprecated\n",
a920ff41 drivers/i2c/i2c-core.c Jean Delvare    2011-04-17  1130  			 driver->driver.name);
b93d3d37 drivers/i2c/i2c-core.c Andy Shevchenko 2016-08-25  1131  		dev_warn(&adap->dev,
b93d3d37 drivers/i2c/i2c-core.c Andy Shevchenko 2016-08-25  1132  			 "Please use another way to instantiate your i2c_client\n");
026526f5 drivers/i2c/i2c-core.c Jean Delvare    2008-01-27  1133  		/* We ignore the return code; if it fails, too bad */
026526f5 drivers/i2c/i2c-core.c Jean Delvare    2008-01-27  1134  		driver->attach_adapter(adap);
026526f5 drivers/i2c/i2c-core.c Jean Delvare    2008-01-27  1135  	}
026526f5 drivers/i2c/i2c-core.c Jean Delvare    2008-01-27  1136  	return 0;
026526f5 drivers/i2c/i2c-core.c Jean Delvare    2008-01-27  1137  }
026526f5 drivers/i2c/i2c-core.c Jean Delvare    2008-01-27  1138  

:::::: The code at line 1128 was first introduced by commit
:::::: 026526f5afcd421dce110f53e4c4e2b9e78753c2 i2c: Drop redundant i2c_driver.list

:::::: TO: Jean Delvare <khali@linux-fr.org>
:::::: CC: Jean Delvare <khali@hyperion.delvare>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Linus Torvalds Aug. 19, 2018, 4:46 p.m. UTC | #2
On Sun, Aug 19, 2018 at 6:51 AM Sedat Dilek <sedat.dilek@credativ.de> wrote:
>
> This can be dropped with commit 771c035372a036f83353eef46dbb829780330234
> ("deprecate the '__deprecated' attribute warnings entirely and for good")
> now in upstream.

Could we please just remove the __deprecated use in i2c entirely?

As fat as I can tell, it's used for one thing, which is the
"attach_adapter" function pointer member in 'struct i2c_driver'.

And I think there is _one_ remaining driver using it, namely the
powermac "therm_windtunnel" driver.

Could somebody who knows the i2c probing just a bit convert that *one*
remaining driver, then remove the "attach_adapter" entirely, and also
remove this thing?

Alternatively, perhaps the driver should be removed? The last actual
powermac change to that driver seems to be from August 2009.
Everything since has been just cleanup unrelated to that driver code
itself (ie spelling fixes, automated coccinelle scripts etc).

Added a few people either because they're still officially maintainers
of that file, or because they touched the code ten years ago.

               Linus
Benjamin Herrenschmidt Aug. 20, 2018, 2:12 a.m. UTC | #3
On Sun, 2018-08-19 at 09:46 -0700, Linus Torvalds wrote:
> On Sun, Aug 19, 2018 at 6:51 AM Sedat Dilek <sedat.dilek@credativ.de> wrote:
> > 
> > This can be dropped with commit 771c035372a036f83353eef46dbb829780330234
> > ("deprecate the '__deprecated' attribute warnings entirely and for good")
> > now in upstream.
> 
> Could we please just remove the __deprecated use in i2c entirely?
> 
> As fat as I can tell, it's used for one thing, which is the
> "attach_adapter" function pointer member in 'struct i2c_driver'.
> 
> And I think there is _one_ remaining driver using it, namely the
> powermac "therm_windtunnel" driver.
> 
> Could somebody who knows the i2c probing just a bit convert that *one*
> remaining driver, then remove the "attach_adapter" entirely, and also
> remove this thing?
> 
> Alternatively, perhaps the driver should be removed? The last actual
> powermac change to that driver seems to be from August 2009.
> Everything since has been just cleanup unrelated to that driver code
> itself (ie spelling fixes, automated coccinelle scripts etc).
> 
> Added a few people either because they're still officially maintainers
> of that file, or because they touched the code ten years ago.

Some people still use those old machines, I'll give a try at fixing the
driver.

Paul: Do you still have one of these machines ?

Cheers
Ben.
Wolfram Sang Aug. 20, 2018, 8:06 a.m. UTC | #4
On Mon, Aug 20, 2018 at 12:12:47PM +1000, Benjamin Herrenschmidt wrote:
> On Sun, 2018-08-19 at 09:46 -0700, Linus Torvalds wrote:
> > On Sun, Aug 19, 2018 at 6:51 AM Sedat Dilek <sedat.dilek@credativ.de> wrote:
> > > 
> > > This can be dropped with commit 771c035372a036f83353eef46dbb829780330234
> > > ("deprecate the '__deprecated' attribute warnings entirely and for good")
> > > now in upstream.
> > 
> > Could we please just remove the __deprecated use in i2c entirely?
> > 
> > As fat as I can tell, it's used for one thing, which is the
> > "attach_adapter" function pointer member in 'struct i2c_driver'.
> > 
> > And I think there is _one_ remaining driver using it, namely the
> > powermac "therm_windtunnel" driver.
> > 
> > Could somebody who knows the i2c probing just a bit convert that *one*
> > remaining driver, then remove the "attach_adapter" entirely, and also
> > remove this thing?
> > 
> > Alternatively, perhaps the driver should be removed? The last actual
> > powermac change to that driver seems to be from August 2009.
> > Everything since has been just cleanup unrelated to that driver code
> > itself (ie spelling fixes, automated coccinelle scripts etc).
> > 
> > Added a few people either because they're still officially maintainers
> > of that file, or because they touched the code ten years ago.
> 
> Some people still use those old machines, I'll give a try at fixing the
> driver.

I did this here a while ago [1] ("macintosh: therm_windtunnel: drop
using attach adapter")...

> Paul: Do you still have one of these machines ?

... but this was the main problem. I couldn't find anyone to test this.
Even asked on PPC lists of various distributions.

Note that we did apply the same approach of patch [1] already in commit
ac397c80de89 ("ALSA: ppc: keywest: drop using attach adapter"). This has
been tested on HW. I also have a hack to make this driver probe on one
of my ARM boards. Of course, no real HW present there, but shows that
the new probing works at least there.

This is very interesting timing, too. Because I wanted to use the
tentative version jump to 5.0 to finally get rid of this deprecated
feature independently of the discussion here. Which would have meant
resending the patch and arguing we have enough indications that the
patch [1] is sane. And then I could finally remove this callback.

Thanks,

   Wolfram

[1] http://patchwork.ozlabs.org/patch/461759/
Benjamin Herrenschmidt Aug. 20, 2018, 11:25 a.m. UTC | #5
On Mon, 2018-08-20 at 10:06 +0200, Wolfram Sang wrote:
> 
> > Some people still use those old machines, I'll give a try at fixing the
> > driver.
> 
> I did this here a while ago [1] ("macintosh: therm_windtunnel: drop
> using attach adapter")...
> 
> > Paul: Do you still have one of these machines ?
> 
> ... but this was the main problem. I couldn't find anyone to test this.
> Even asked on PPC lists of various distributions.

Yeah this one is annoying because it's only used by one specific
machine model..

> Note that we did apply the same approach of patch [1] already in commit
> ac397c80de89 ("ALSA: ppc: keywest: drop using attach adapter"). This has
> been tested on HW. I also have a hack to make this driver probe on one
> of my ARM boards. Of course, no real HW present there, but shows that
> the new probing works at least there.
> 
> This is very interesting timing, too. Because I wanted to use the
> tentative version jump to 5.0 to finally get rid of this deprecated
> feature independently of the discussion here. Which would have meant
> resending the patch and arguing we have enough indications that the
> patch [1] is sane. And then I could finally remove this callback.
> 
> Thanks,
> 
>    Wolfram
> 
> [1] http://patchwork.ozlabs.org/patch/461759/

Ok, worst case we can remove the driver and re-instate it back later if
somebody complains, but I'll try to chase a machine first.

Cheers,
Ben.
Linus Torvalds Aug. 20, 2018, 8:36 p.m. UTC | #6
On Mon, Aug 20, 2018 at 1:06 AM Wolfram Sang <wsa@the-dreams.de> wrote:
>
> [1] http://patchwork.ozlabs.org/patch/461759/

Let's just apply this.

If it breaks something and somebody notices, we'll at least have found a tester.

And if it doesn't break anything, or if nobody ever notices the
breakage, then we will have gotten rid of that deprecated function.

Either way we win. There's no downside.

Wolfram, should I just take that patch as-is and get rid of the
deprecated atach_adapter thing, or will you send me a pull request?

                 Linus
Wolfram Sang Aug. 21, 2018, 2:04 a.m. UTC | #7
Linus,

> Wolfram, should I just take that patch as-is and get rid of the
> deprecated atach_adapter thing, or will you send me a pull request?

I'll send you a pull request.

Thanks,

   Wolfram
Wolfram Sang Aug. 24, 2018, 1:01 p.m. UTC | #8
Sedat,

> This can be dropped with commit 771c035372a036f83353eef46dbb829780330234
> ("deprecate the '__deprecated' attribute warnings entirely and for good")
> now in upstream.

The pull request removing attach_adapter() is on the way now. Thanks for
triggering all this!

Happy hacking,

   Wolfram
Sedat Dilek Aug. 24, 2018, 1:49 p.m. UTC | #9
Hi Wolfram,

will my patch go to [1]?

Thank you, too.

Regards,
- Sedat -

[1] https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git/log/?h=i2c/for-next

> Wolfram Sang <wsa@the-dreams.de> hat am 24. August 2018 um 15:01 geschrieben:
> 
> 
> Sedat,
> 
> > This can be dropped with commit 771c035372a036f83353eef46dbb829780330234
> > ("deprecate the '__deprecated' attribute warnings entirely and for good")
> > now in upstream.
> 
> The pull request removing attach_adapter() is on the way now. Thanks for
> triggering all this!
> 
> Happy hacking,
> 
>    Wolfram
Wolfram Sang Aug. 24, 2018, 2:07 p.m. UTC | #10
> will my patch go to [1]?

It won't be needed anymore, the __deprecated function will go away until
next week.
Sedat Dilek Aug. 24, 2018, 2:19 p.m. UTC | #11
> Wolfram Sang <wsa@the-dreams.de> hat am 24. August 2018 um 16:07 geschrieben:
> 
> 
> 
> > will my patch go to [1]?
> 
> It won't be needed anymore, the __deprecated function will go away until
> next week.
>

The relict in drivers/i2/Makefile should go away, too.

- sed@ -

[1] https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git/tree/drivers/i2c/Makefile?h=i2c/for-next#n21
Wolfram Sang Aug. 24, 2018, 3:01 p.m. UTC | #12
On Fri, Aug 24, 2018 at 04:19:53PM +0200, Sedat Dilek wrote:
> > Wolfram Sang <wsa@the-dreams.de> hat am 24. August 2018 um 16:07 geschrieben:
> > 
> > 
> > 
> > > will my patch go to [1]?
> > 
> > It won't be needed anymore, the __deprecated function will go away until
> > next week.
> >
> 
> The relict in drivers/i2/Makefile should go away, too.

Correct. I will apply your patch, just with an shoertened commit message
(because the use case is gone) if this is OK with you.
Sedat Dilek Aug. 24, 2018, 3:03 p.m. UTC | #13
> Wolfram Sang <wsa@the-dreams.de> hat am 24. August 2018 um 17:01 geschrieben:
> 
> 
> On Fri, Aug 24, 2018 at 04:19:53PM +0200, Sedat Dilek wrote:
> > > Wolfram Sang <wsa@the-dreams.de> hat am 24. August 2018 um 16:07 geschrieben:
> > > 
> > > 
> > > 
> > > > will my patch go to [1]?
> > > 
> > > It won't be needed anymore, the __deprecated function will go away until
> > > next week.
> > >
> > 
> > The relict in drivers/i2/Makefile should go away, too.
> 
> Correct. I will apply your patch, just with an shoertened commit message
> (because the use case is gone) if this is OK with you.

OK, Thanks.
diff mbox series

Patch

diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
index 72c94c60fdd1..bed6ba63c983 100644
--- a/drivers/i2c/Makefile
+++ b/drivers/i2c/Makefile
@@ -18,4 +18,3 @@  obj-$(CONFIG_I2C_STUB)		+= i2c-stub.o
 obj-$(CONFIG_I2C_SLAVE_EEPROM)	+= i2c-slave-eeprom.o
 
 ccflags-$(CONFIG_I2C_DEBUG_CORE) := -DDEBUG
-CFLAGS_i2c-core-base.o := -Wno-deprecated-declarations