From: Hans Hu <HansHu-oc@zhaoxin.com>
To: <arnd@kernel.org>, <andi.shyti@kernel.org>,
<wsa+renesas@sang-engineering.com>
Cc: <wentong.wu@intel.com>, <linux-i2c@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>, <hanshu@zhaoxin.com>
Subject: [PATCH] i2c: viai2c: turn common code into a proper module
Date: Thu, 30 May 2024 11:33:39 +0800 [thread overview]
Message-ID: <a8d9c382-7cdc-4775-b921-251c90819a29@zhaoxin.com> (raw)
In-Reply-To: <fadeb87cdff64e84967ffb83621ebcd0@zhaoxin.com>
Hi Arnd,
> From: Arnd Bergmann <arnd@arndb.de>
>
> The i2c-viai2c-common.c file is used by two drivers, but is not a proper abstraction and can get linked into both modules in the same configuration, which results in a warning:
>
> scripts/Makefile.build:236: drivers/i2c/busses/Makefile: i2c-viai2c-common.o is added to multiple modules: i2c-wmt i2c-zhaoxin
>
> The other problems with this include the incorrect use of a __weak function when both are built-in, and the fact that the "common" module is sprinked with 'if (i2c->plat == ...)' checks that have knowledge about the differences between the drivers using it.
>
> Avoid the link time warning by making the common driver a proper module with MODULE_LICENCE()/MODULE_AUTHOR() tags, and remove the __weak function by slightly rearranging the code.
>
> This adds a little more duplication between the two main drivers, but those versions get more readable in the process.
>
> Fixes: a06b80e83011 ("i2c: add zhaoxin i2c controller driver")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/i2c/busses/Makefile | 6 +-
> drivers/i2c/busses/i2c-viai2c-common.c | 71 ++-------------
> drivers/i2c/busses/i2c-viai2c-common.h | 2 +-
> drivers/i2c/busses/i2c-viai2c-wmt.c | 37 ++++++++
> drivers/i2c/busses/i2c-viai2c-zhaoxin.c | 113 +++++++++++++++++++-----
> 5 files changed, 140 insertions(+), 89 deletions(-)
I tested this patch and it works fine, so I am OK with it.
Hans
next prev parent reply other threads:[~2024-05-30 3:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-28 12:06 [PATCH] i2c: viai2c: turn common code into a proper module Arnd Bergmann
[not found] ` <fadeb87cdff64e84967ffb83621ebcd0@zhaoxin.com>
2024-05-30 3:33 ` Hans Hu [this message]
2024-06-04 8:00 ` Wolfram Sang
2024-06-26 10:42 ` Wolfram Sang
2024-06-26 14:01 ` Andi Shyti
2024-06-26 16:04 ` Andi Shyti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a8d9c382-7cdc-4775-b921-251c90819a29@zhaoxin.com \
--to=hanshu-oc@zhaoxin.com \
--cc=20240528120710.3433792-1-arnd@kernel.org \
--cc=andi.shyti@kernel.org \
--cc=arnd@kernel.org \
--cc=hanshu@zhaoxin.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wentong.wu@intel.com \
--cc=wsa+renesas@sang-engineering.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox