public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: "Thomas Weißschuh " <thomas@t-8ch.de>
To: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: "Thomas Weißschuh" <linux@weissschuh.net>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Jiri Kosina" <jikos@kernel.org>,
	"David Rheinsberg" <david.rheinsberg@gmail.com>,
	"Marcel Holtmann" <marcel@holtmann.org>,
	"Johan Hedberg" <johan.hedberg@gmail.com>,
	"Luiz Augusto von Dentz" <luiz.dentz@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-usb@vger.kernel.org, linux-bluetooth@vger.kernel.org,
	netdev@vger.kernel.org
Subject: Re: [PATCH 2/8] HID: usbhid: Make hid_is_usb() non-inline
Date: Thu, 22 Dec 2022 16:37:21 -0500 (EST)	[thread overview]
Message-ID: <4d42a44d-e0f3-4d01-8564-267d0f3f061a@t-8ch.de> (raw)
In-Reply-To: <CAO-hwJL+zenkC+qPuPWLO-dFkg_pWoGTQYXR5mzSqUrnX6MObA@mail.gmail.com>


Dec 22, 2022 16:13:06 Benjamin Tissoires <benjamin.tissoires@redhat.com>:

> On Thu, Dec 22, 2022 at 6:16 AM Thomas Weißschuh <linux@weissschuh.net> wrote:
>>
>> By making hid_is_usb() a non-inline function the lowlevel usbhid driver
>> does not have to be exported anymore.
>>
>> Also mark the argument as const as it is not modified.
>>
>> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
>> ---
>> drivers/hid/usbhid/hid-core.c | 6 ++++++
>> include/linux/hid.h           | 5 +----
>> 2 files changed, 7 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
>> index be4c731aaa65..54b0280d0073 100644
>> --- a/drivers/hid/usbhid/hid-core.c
>> +++ b/drivers/hid/usbhid/hid-core.c
>> @@ -1334,6 +1334,12 @@ struct hid_ll_driver usb_hid_driver = {
>> };
>> EXPORT_SYMBOL_GPL(usb_hid_driver);
>>
>> +bool hid_is_usb(const struct hid_device *hdev)
>> +{
>> +       return hdev->ll_driver == &usb_hid_driver;
>> +}
>> +EXPORT_SYMBOL_GPL(hid_is_usb);
>> +
>> static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *id)
>> {
>>         struct usb_host_interface *interface = intf->cur_altsetting;
>> diff --git a/include/linux/hid.h b/include/linux/hid.h
>> index 8677ae38599e..e8400aa78522 100644
>> --- a/include/linux/hid.h
>> +++ b/include/linux/hid.h
>> @@ -864,10 +864,7 @@ static inline bool hid_is_using_ll_driver(struct hid_device *hdev,
>>         return hdev->ll_driver == driver;
>> }
>>
>> -static inline bool hid_is_usb(struct hid_device *hdev)
>> -{
>> -       return hid_is_using_ll_driver(hdev, &usb_hid_driver);
>> -}
>> +extern bool hid_is_usb(const struct hid_device *hdev);
>
> The problem here is that CONFIG_USB_HID can be set to either m or n.
> In the n case, you'll end up with an undefined symbol, in the m case,
> it won't link too if CONFIG_HID is set to Y (and it'll be quite a mess
> to call it if the module is not loaded yet).

Shouldn't we already have the same problem with
the symbol usb_hid_driver itself that is defined
right next to the new hid_is_usb()?

Thomas

>>
>> #define        PM_HINT_FULLON  1<<5
>> #define PM_HINT_NORMAL 1<<1
>>
>> --
>> 2.39.0
>>


  reply	other threads:[~2022-12-22 21:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-22  5:10 [PATCH 0/8] HID: remove some unneeded exported symbols from hid.h Thomas Weißschuh
2022-12-22  5:10 ` [PATCH 1/8] HID: letsketch: Use hid_is_usb() Thomas Weißschuh
2022-12-22  5:59   ` HID: remove some unneeded exported symbols from hid.h bluez.test.bot
2022-12-22  5:10 ` [PATCH 2/8] HID: usbhid: Make hid_is_usb() non-inline Thomas Weißschuh
2022-12-22 21:12   ` Benjamin Tissoires
2022-12-22 21:37     ` Thomas Weißschuh  [this message]
2022-12-23  7:56       ` Benjamin Tissoires
2022-12-22  5:10 ` [PATCH 3/8] HID: Remove unused function hid_is_using_ll_driver() Thomas Weißschuh
2022-12-22  5:10 ` [PATCH 4/8] HID: Unexport struct usb_hid_driver Thomas Weißschuh
2022-12-22  5:10 ` [PATCH 5/8] HID: Unexport struct uhid_hid_driver Thomas Weißschuh
2022-12-22  5:10 ` [PATCH 6/8] HID: Unexport struct hidp_hid_driver Thomas Weißschuh
2022-12-22  5:10 ` [PATCH 7/8] HID: Unexport struct i2c_hid_ll_driver Thomas Weißschuh
2022-12-22  5:10 ` [PATCH 8/8] HID: Make lowlevel driver structs const Thomas Weißschuh
2022-12-22 15:27 ` [PATCH 0/8] HID: remove some unneeded exported symbols from hid.h David Rheinsberg
2023-01-09  8:39 ` Hans de Goede
2023-01-17 12:45 ` Jiri Kosina

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=4d42a44d-e0f3-4d01-8564-267d0f3f061a@t-8ch.de \
    --to=thomas@t-8ch.de \
    --cc=benjamin.tissoires@redhat.com \
    --cc=davem@davemloft.net \
    --cc=david.rheinsberg@gmail.com \
    --cc=edumazet@google.com \
    --cc=hdegoede@redhat.com \
    --cc=jikos@kernel.org \
    --cc=johan.hedberg@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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