Re: [PATCH] Bluetooth: Add hci_h4p driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday 24 October 2013 20:41:53 Joe Perches wrote:
> On Fri, 2013-10-18 at 12:30 +0200, Pali Rohár wrote:
> > I rebased patch on top of
> > https://git.kernel.org/cgit/linux/kernel/git/bluetooth/blue
> > tooth-next.git branch master
> 
> Hi Pali, just some trivial notes:
> 
> []
> 
> +static ssize_t hci_h4p_show_bdaddr(struct device *dev,
> 
> > +                                  struct device_attribute
> > *attr, char *buf) +{
> > +       struct hci_h4p_info *info = dev_get_drvdata(dev);
> > +
> > +       return sprintf(buf,
> > "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", +                     
> > info->bd_addr[0], info->bd_addr[1], info->bd_addr[2], +    
> >                  info->bd_addr[3], info->bd_addr[4],
> > info->bd_addr[5]);
> 
> sprintf(buf, "%pM", info->bd_addr)
> 

"%pM" modifier printing mac address?

> and if this is really bluetooth, does the output need to
> be emitted in reverse order?  ie: %pMR
> 

I'm sure that actual order of above code is correct.
So what to use? "%pM" or "%pMR"?

> []
> 
> > +#define NBT_DBG(fmt, arg...) \
> > +               pr_debug("%s: " fmt "" , __func__ , ## arg)
> > +
> > +#define NBT_DBG_FW(fmt, arg...) \
> > +               pr_debug("%s: " fmt "" , __func__ , ## arg)
> > +
> > +#define NBT_DBG_POWER(fmt, arg...) \
> > +               pr_debug("%s: " fmt "" , __func__ , ## arg)
> > +
> > +#define NBT_DBG_TRANSFER(fmt, arg...) \
> > +               pr_debug("%s: " fmt "" , __func__ , ## arg)
> > +
> > +#define NBT_DBG_TRANSFER_NF(fmt, arg...) \
> > +               pr_debug(fmt "" , ## arg)
> > +
> > +#define NBT_DBG_DMA(fmt, arg...) \
> > +               pr_debug("%s: " fmt "" , __func__ , ## arg)
> 
> The "" isn't useful.
> 
> dynamic_debugging can add __func__ to each message output
> with +f.
> 
> I think all of these should be converted to pr_debug
> where used or consolidated into a single
> #define nbt_dbg(mask, fmt, ...)			\
> do {						\
> 	if (mask & debug)			\
> 		pr_debug(fmt, ##__VA_ARGS__);
> } while (0)
> 
> and used like:
> 	nbt_dbg(TRANSFER, fmt, etc...);
> where debug is some static.
> 
> Also there are many uses missing "\n" which can
> cause interleaving problems with other printks.
> 
> []
> 
> > +int hci_h4p_wait_for_cts(struct hci_h4p_info *info, int
> > active, +                        int timeout_ms)
> > +{
> > +       unsigned long timeout;
> > +       int state;
> > +
> > +       timeout = jiffies + msecs_to_jiffies(timeout_ms);
> > +       for (;;) {
> 
> 	while (time_before(jiffies, timeout)) {
> 
> > +               state = hci_h4p_inb(info, UART_MSR) &
> > UART_MSR_CTS; +               if (active) {
> > +                       if (state)
> > +                               return 0;
> > +               } else {
> > +                       if (!state)
> > +                               return 0;
> > +               }
> > +               if (time_after(jiffies, timeout))
> > +                       return -ETIMEDOUT;
> > 
> > +               msleep(1);
> > +       }
> 
> 	return -ETIMEDOUT;
> 
> > +}

-- 
Pali Rohár
pali.rohar@xxxxxxxxx

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux