linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: Marcel Holtmann <marcel@holtmann.org>,
	Johan Hedberg <johan.hedberg@gmail.com>,
	"linux-bluetooth@vger.kernel.org"
	<linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH] Bluetooth: use helper function for monitor's open/close notifications
Date: Mon, 26 Jul 2021 14:26:03 -0700	[thread overview]
Message-ID: <CABBYNZLk2sYggimVfBx1vcYbG7-sBsVKS1+SujaR054DjVSaHA@mail.gmail.com> (raw)
In-Reply-To: <e51b7339-a432-de99-89a9-d97be776ee5d@i-love.sakura.ne.jp>

Hi Tetsuo,

On Mon, Jul 26, 2021 at 1:40 PM Tetsuo Handa
<penguin-kernel@i-love.sakura.ne.jp> wrote:
>
> On 2021/07/27 2:40, Luiz Augusto von Dentz wrote:
> >> diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
> >> index 786a06a232fd..fc2336855dab 100644
> >> --- a/net/bluetooth/hci_sock.c
> >> +++ b/net/bluetooth/hci_sock.c
> >> @@ -295,6 +295,11 @@ void hci_send_to_channel(unsigned short channel, struct sk_buff *skb,
> >>         read_unlock(&hci_sk_list.lock);
> >>  }
> >>
> >> +static void __hci_send_to_monitor(struct sk_buff *skb)
> >> +{
> >
> > We can probably have the checks of NULL skb added directly here and
> > perhaps kfree_skb as well since it seems it is always a copy that is
> > sent here,
>
> The NULL skb check is in hci_monitor_ctrl_open() and hci_monitor_ctrl_close().
> The purpose of __hci_send_to_monitor() is to hide common arguments.

All instances that call into it do seem to have the NULL check and
kfree, in fact hci_monitor_ctrl_open and hci_monitor_ctrl_close do
exactly the same thing:

+       if (skb) {
+               __hci_send_to_monitor(skb);
+               kfree_skb(skb);
+       }

Perhap we can call it hci_send_ctrl_to_monitor:

static void hci_send_ctrl_to_monitor(struct sk_buff *skb)
{
       if (!skb)
           return;

       hci_send_to_channel(HCI_CHANNEL_MONITOR, skb, HCI_SOCK_TRUSTED, NULL);

       kfree_skb(skb);
}

>
> >            the hci_send_to_monitor don't have __ prefix so I wonder
> > why you have chosen to use it?
>
> Only to avoid name conflict with hci_send_to_monitor(). I thought that
> the __ prefix is fine because hci_send_to_monitor() also calls this function.
> Please suggest whatever name you want to use.
>
> >
> >> +       hci_send_to_channel(HCI_CHANNEL_MONITOR, skb, HCI_SOCK_TRUSTED, NULL);
> >> +}
> >> +
> >>  /* Send frame to monitor socket */
> >>  void hci_send_to_monitor(struct hci_dev *hdev, struct sk_buff *skb)
> >>  {
>


-- 
Luiz Augusto von Dentz

  reply	other threads:[~2021-07-26 21:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-24 14:03 Tetsuo Handa
2021-07-26 17:40 ` Luiz Augusto von Dentz
2021-07-26 20:39   ` Tetsuo Handa
2021-07-26 21:26     ` Luiz Augusto von Dentz [this message]
2021-07-27  2:09 ` bluez.test.bot

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=CABBYNZLk2sYggimVfBx1vcYbG7-sBsVKS1+SujaR054DjVSaHA@mail.gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --subject='Re: [PATCH] Bluetooth: use helper function for monitor'\''s open/close notifications' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).