mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ian Abbott <abbotti@mev.co.uk>
To: Joe Perches <joe@perches.com>
Cc: "Greg KH" <greg@kroah.com>,
	"Frank Mori Hess" <fmhess@users.sourceforge.net>,
	"Mark Rankilor" <reodge@gmail.com>,
	"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
	"Henri Häkkinen" <henuxd@gmail.com>,
	"gregkh@suse.de" <gregkh@suse.de>,
	"andrea.gelmini@gelma.net" <andrea.gelmini@gelma.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] staging:comedi: Fixed coding convention issues.
Date: Fri, 18 Jun 2010 13:16:43 +0100	[thread overview]
Message-ID: <4C1B63AB.8060200@mev.co.uk> (raw)
In-Reply-To: <1276818421.1005.99.camel@Joe-Laptop.home>

On 18/06/10 00:47, Joe Perches wrote:
> On Thu, 2010-06-17 at 16:28 -0700, Greg KH wrote:
>> On Thu, Jun 17, 2010 at 04:15:58PM -0700, Joe Perches wrote:
>>> On Thu, 2010-06-17 at 15:51 -0700, Greg KH wrote:
>>>> On Sat, Jun 12, 2010 at 10:30:50PM -0700, Joe Perches wrote:
>>>>> On Sat, 2010-06-12 at 22:07 -0700, Joe Perches wrote:
>>>>>> 2: Create some comedi logging functions or macros like:
>>>>>>    	comedi_<level>(fmt, arg...) (ie: comedi_info, comedi_err, etc)
>>>>>>    where "comedi:" is always prefixed and an
>>>>>>    optional #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>>>>>>    could be used.
>>>
>>>> I would prefer the conversion of everything over to the dev_printk()
>>>> versions instead of creating a new macro for every individual subsystem.
>>>> That way you get the advantage of logging everything in the common
>>>> format and the dynamic debug functionality as well.
>>>
>>> What I posted has dynamic_debug.
>>>
>>> +#elif defined(CONFIG_DYNAMIC_DEBUG)
>>> +/* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */
>>> +#define comedi_debug(fmt, ...)                         \
>>> +       dynamic_pr_debug(fmt, ##__VA_ARGS__)
>>>
>>> As far as I know, comedi doesn't always take a struct device *.
>>> I believe it's only used when there's a DMA.
>>
>> No, there's a struct device down in the device almost always.
>>
>>> In struct comedi_device, there are two struct device *'s.
>>>
>>> 	struct device *class_dev;
>>> ...
>>> 	struct device *hw_dev;
>>
>> hw_dev is what we want to use.
> 
> Perhaps Ian or Frank might clarify if
> that's reasonable.  It doesn't look like
> it to me.
> 
> Look at comedi_set_hw_dev.
> See how often it's used?

It's only set by a few drivers currently.  Perhaps it should be set by
comedi_alloc_board_minor() using the 'hardware_device' parameter.
However, in the case of "legacy" comedi devices (the ones not configured
automatically via comedi_auto_config()), that parameter will be NULL.

On a side note, if comedi_alloc_board_minor() were changed to call
comedi_set_hw_dev(), then the driver "_attach" routines could be changed
to check that they really are attaching to the correct hardware device
rather than relying on the struct comedi_devconfig options array values
(which aren't set anyway for auto-configured USB devices).
comedi_set_hw_dev() also ought to return early if the new hw_dev value
is the same as the previous value.

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-

  reply	other threads:[~2010-06-18 12:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-12 10:14 Henri Häkkinen
2010-06-13  2:14 ` Mark Rankilor
2010-06-13  5:07   ` Joe Perches
2010-06-13  5:30     ` Joe Perches
2010-06-13 11:27       ` Henri Häkkinen
2010-06-13 18:11         ` Joe Perches
2010-06-17 22:51       ` Greg KH
2010-06-17 23:15         ` Joe Perches
2010-06-17 23:28           ` Greg KH
2010-06-17 23:47             ` Joe Perches
2010-06-18 12:16               ` Ian Abbott [this message]
2010-06-12 11:04 Henri Häkkinen
2010-06-14  6:34 Henri Häkkinen
2010-06-17 23:02 ` Greg KH

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=4C1B63AB.8060200@mev.co.uk \
    --to=abbotti@mev.co.uk \
    --cc=andrea.gelmini@gelma.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=fmhess@users.sourceforge.net \
    --cc=greg@kroah.com \
    --cc=gregkh@suse.de \
    --cc=henuxd@gmail.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=reodge@gmail.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

Powered by JetHome