linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sean Wang <sean.wang@mediatek.com>
To: Johan Hovold <johan@kernel.org>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
	Mark Rutland <mark.rutland@arm.com>,
	devicetree <devicetree@vger.kernel.org>,
	"Johan Hedberg" <johan.hedberg@gmail.com>,
	Marcel Holtmann <marcel@holtmann.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	<linux-bluetooth@vger.kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	"moderated list:ARM/Mediatek SoC support" 
	<linux-mediatek@lists.infradead.org>,
	linux-arm Mailing List <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v4 6/7] Bluetooth: mediatek: Add protocol support for MediaTek serial devices
Date: Fri, 29 Jun 2018 17:47:26 +0800	[thread overview]
Message-ID: <1530265646.6245.6.camel@mtkswgap22> (raw)
In-Reply-To: <20180628051941.GF629@localhost>

On Thu, 2018-06-28 at 07:19 +0200, Johan Hovold wrote:
> On Thu, Jun 28, 2018 at 11:06:13AM +0800, Sean Wang wrote:
> > On Wed, 2018-06-27 at 20:04 +0300, Andy Shevchenko wrote:
> > > On Wed, Jun 27, 2018 at 7:59 PM, Andy Shevchenko
> > > <andy.shevchenko@gmail.com> wrote:
> > > > On Wed, Jun 27, 2018 at 8:43 AM,  <sean.wang@mediatek.com> wrote:
> > > >> From: Sean Wang <sean.wang@mediatek.com>
> 
> > > >> +#include <net/bluetooth/bluetooth.h>
> > > >> +#include <net/bluetooth/hci_core.h>
> > > 
> > > >> +       /* Enable the power domain and clock the device requires. */
> > > >> +       pm_runtime_enable(dev);
> > > >> +       err = pm_runtime_get_sync(dev);
> > > >> +       if (err < 0)
> > > >> +               goto err_pm2;
> 
> > > >> +err_pm1:
> > > >> +       pm_runtime_put_sync(dev);
> > > >> +err_pm2:
> > > >> +       pm_runtime_disable(dev);
> 
> Please name error labels after what they do, not using numbers (see
> CodingStyle). Here you could use err_disable_rpm instead of err_pm2, for
> example.
> 
> Also, if you really want to undo pm_runtime_get_sync() failing above,
> you still need a pm_runtime_put_noidle() to balance the usage count.
> 

I'll give a reasonable naming for these labels and add a
pm_runtime_put_noidle() in the path undoing failing
pm_runtime_get_sync().

> > > >> +struct mtk_stp_hdr {
> > > >> +       __u8 prefix;
> > > >> +       __u8 dlen1:4;
> > > >> +       __u8 type:4;
> > > 
> > > >> +       __u8 dlen2:8;
> > > >> +       __u8 cs;
> > > >> +} __packed;
> 
> Perhaps too much context have been lost here, but unless you're sharing
> this struct with user space, you should be using u8 (without __) above
> (and elsewhere).
> 

These struct don't be shard with user space so I will turn __u8 into u8.

Thanks so much for all suggestions. 

> Johan



  reply	other threads:[~2018-06-29  9:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-27  5:43 [PATCH v4 0/7] add support for Bluetooth on MT7622 SoC sean.wang
2018-06-27  5:43 ` [PATCH v4 1/7] dt-bindings: net: bluetooth: Add mediatek-bluetooth sean.wang
2018-06-27  5:43 ` [PATCH v4 2/7] serdev: add dev_pm_domain_attach|detach() sean.wang
2018-06-27  8:00   ` Ulf Hansson
2018-06-27  5:43 ` [PATCH v4 3/7] Bluetooth: Add new serdev based driver for UART attached controllers sean.wang
2018-06-27  5:43 ` [PATCH v4 4/7] Bluetooth: Add new quirk for non-persistent setup settings sean.wang
2018-06-27  5:43 ` [PATCH v4 5/7] Bluetooth: Extend btuart driver for join more vendor devices sean.wang
2018-06-27  5:43 ` [PATCH v4 6/7] Bluetooth: mediatek: Add protocol support for MediaTek serial devices sean.wang
2018-06-27 16:59   ` Andy Shevchenko
2018-06-27 17:04     ` Andy Shevchenko
2018-06-28  3:06       ` Sean Wang
2018-06-28  5:19         ` Johan Hovold
2018-06-29  9:47           ` Sean Wang [this message]
2018-06-28  2:54     ` Sean Wang
2018-06-27  5:43 ` [PATCH v4 7/7] MAINTAINERS: add an entry for MediaTek Bluetooth driver sean.wang

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=1530265646.6245.6.camel@mtkswgap22 \
    --to=sean.wang@mediatek.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=johan.hedberg@gmail.com \
    --cc=johan@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=marcel@holtmann.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).