From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfram Sang Date: Thu, 10 Dec 2015 13:34:46 +0000 Subject: Re: [PATCH] i2c: allow building emev2 without slave mode again Message-Id: <20151210133446.GC1573@katana> MIME-Version: 1 Content-Type: multipart/mixed; boundary="bKyqfOwhbdpXa4YI" List-Id: References: <2144222.LfzPx9mJ0p@wuerfel> In-Reply-To: <2144222.LfzPx9mJ0p@wuerfel> To: linux-arm-kernel@lists.infradead.org --bKyqfOwhbdpXa4YI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 10, 2015 at 02:14:49PM +0100, Arnd Bergmann wrote: > The emev2 driver stopped compiling in today's linux-next kernel: >=20 > drivers/i2c/busses/i2c-emev2.c: In function 'em_i2c_slave_irq': > drivers/i2c/busses/i2c-emev2.c:233:23: error: storage size of 'event' isn= 't known > drivers/i2c/busses/i2c-emev2.c:250:3: error: implicit declaration of func= tion 'i2c_slave_event' [-Werror=3Dimplicit-function-declaration] > drivers/i2c/busses/i2c-emev2.c:250:32: error: 'I2C_SLAVE_STOP' undeclared= (first use in this function) >=20 > It works again if we enable CONFIG_I2C_SLAVE, but it seems wrong > to add a dependency on that symbol: >=20 > * The symbol is user-selectable, but only one or two (including this > one) bus drivers actually implement it, and it makes no sense > if you don't have one of them. >=20 > * The other driver (R-Car) uses 'select I2C_SLAVE', which seems > reasonable in principle, but we should not do that on user > visible symbols. >=20 > * I2C slave mode could be implemented in a lot of other drivers > as an optional feature, but we shouldn't require enabling it > if we don't use it. >=20 > This changes the two drivers that provide I2C slave mode so they > can again build if the slave mode being disabled. To do this, I > move the definition of i2c_slave_event() and enum i2c_slave_event > out of the #ifdef and instead make the assignment of the reg_slave > and unreg_slave pointers optional in the bus drivers. The functions > implementing the feature are unused in that case, so they get > marked as __maybe_unused in order to still give compile-time > coverage. Thanks a lot! Making this clear and consistent was on my todo-list, unfortunately below some other items. Both drivers have quite orthogonal slave_irq routines. What do you think about grouping this and the reg/unreg-calls together and compile them conditionally on I2C_SLAVE? I think the code savings are worth it. --bKyqfOwhbdpXa4YI Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWaX92AAoJEBQN5MwUoCm2xw8P/3Y+0RCviV4KQYdUaMl4e3VK pZZlI/osS4wsq+RfsElWd5txyWbvIhqiaStC+B8f7GV6z96aqFZeKvWZlxtmYXGM 9JDn9nUTMQGtOmqOZSwdTuk8WqKXoHB+2n7QdqwiZq5Xcowfq8eYgSyWCnQpTfdy xAjMSarFkLjSiG7GnwE9oPAX9EtZNl/OTNtx7uKNqf8Jad9jPdn4GK0RT8EIE5eb btVPHa6GDjz9VYQleyVk50TJe9f8DL5i7yoXu/YRQRyiedt7t6MgzyOZ7Lx5Ht7/ r/U4mvqRYkBDzYD863Wzp41Jxk5GroJpbtV9luB+tN5hVIlmsYgckJLfPwI1Tj3R 5Xm00V2GOviFG6wvkMKlcezWk7OZWwjSgTZzyrzLpeoQu0RILf79E1b0yjBZWFbM V/9RZm5WSJbW6PhidLXYOUD40DBpGoxRsyvw2AQbhR3k2KwCwdm9wk9gBfO6UAZ8 mwL1bUf4z7gk7NAmj4rE6YpHIJl5Mf7viQpM/vDpa03nlcWtpWJb7oxmrLt7JoSF EwwoymzN9SAb03pkMxi9GfAgNVnEcl2WyXpahOXhhvqZCpGr+AYmAqCIFY34D3cR 0trK0+imBl6+NjsWitKMvInWp+eqIcZpjeNl5km5u7G/LbcfKG3VGe5Qc4V5dazh modOi6MVAYjar9OIbXUu =2yWp -----END PGP SIGNATURE----- --bKyqfOwhbdpXa4YI--