linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Stephane Grosjean <s.grosjean@peak-system.com>,
	"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Cc: Oliver Hartkopp <socketcan@hartkopp.net>
Subject: Re: [PATCH 2/3] can/peak_usb: CAN-FD: add new adapters specific files
Date: Wed, 03 Dec 2014 10:53:42 +0100	[thread overview]
Message-ID: <547EDDA6.3070903@pengutronix.de> (raw)
In-Reply-To: <547EDA21.6030802@peak-system.com>

[-- Attachment #1: Type: text/plain, Size: 1849 bytes --]

On 12/03/2014 10:38 AM, Stephane Grosjean wrote:
> Le 02/12/2014 16:17, Marc Kleine-Budde a écrit :
>> On 12/02/2014 04:08 PM, Stephane Grosjean wrote:
>>>>>    drivers/net/can/usb/peak_usb/pcan_ucan.h   | 208 +++++++
>>>>>    drivers/net/can/usb/peak_usb/pcan_usb_fd.c | 955
>>>>> +++++++++++++++++++++++++++++
>>>>>    drivers/net/can/usb/peak_usb/pcan_usb_fd.h | 108 ++++
>>>> Please don't create a header file, if it's only included once. Please
>>>> merge into the correct .c file.
>>> Ok. So I merge both header files into the .c file. There will be only a
>>> single (and big) pcan_usb_fd.c file.
>> Yes, we only want code in header files that's used in more than one .c
>> file.
> 
> Is this rule quite recent? I mean, the current version of peak_usb
> contains "pcan_usb_pro.h" which is included only by "pcan_usb_pro.c"?
> 
> Moreover, "pcan_ucan.h" defines some data structures that might be used
> by some other new "non USB" PEAK -FD devices (peak_pci, for example).
> So, how to manage to avoid to have to define several times the same data
> structures and constants, please?

If something is used by more than one .c file, put it in a header. If
it's only used in one .c file, put it into that .c file.

Follow this rule when adding this driver to the kernel. When you add a
new driver in the future and now some data structures/definitions/etc...
are shared between more then one driver or .c file, simply move that
code into a header and include the header in all .c file where you need it.

Hope this clarifies it,
Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2014-12-03 10:31 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-27 10:32 [PATCH 0/3] Add support for PEAK CAN-FD USB adapters Stephane Grosjean
2014-11-27 10:32 ` [PATCH 1/3] can/peak_usb: CAN-FD: existing source files modifications Stephane Grosjean
2014-11-27 11:44   ` Oliver Hartkopp
2014-11-27 21:27   ` Marc Kleine-Budde
     [not found]     ` <547DBADC.2020009@pengutronix.de>
2014-12-02 13:55       ` Stephane Grosjean
2014-12-02 14:02         ` Marc Kleine-Budde
2014-11-27 10:32 ` [PATCH 2/3] can/peak_usb: CAN-FD: add new adapters specific files Stephane Grosjean
2014-11-27 22:28   ` Marc Kleine-Budde
     [not found]     ` <547DBAEC.6010903@pengutronix.de>
2014-12-02 15:08       ` Stephane Grosjean
2014-12-02 15:17         ` Marc Kleine-Budde
2014-12-03  9:38           ` Stephane Grosjean
2014-12-03  9:53             ` Marc Kleine-Budde [this message]
2014-12-03 10:16             ` Oliver Hartkopp
2014-12-03 10:38               ` Stephane Grosjean
2014-12-03 10:45                 ` Marc Kleine-Budde
2014-12-03 10:50                   ` Oliver Hartkopp
2014-12-03 11:20                     ` Stephane Grosjean
2014-12-03 11:51                       ` Oliver Hartkopp
2014-12-03 12:34                         ` Stephane Grosjean
2014-12-03 12:57                           ` Oliver Hartkopp
2014-12-03 13:18                             ` Stephane Grosjean
2014-12-03 13:19                             ` Marc Kleine-Budde
2014-11-27 10:32 ` [PATCH 3/3] can/peak_usb: CAN-FD: driver's core modifications Stephane Grosjean
2014-11-27 11:43   ` Oliver Hartkopp
2014-11-28 10:03     ` Stephane Grosjean

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=547EDDA6.3070903@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=s.grosjean@peak-system.com \
    --cc=socketcan@hartkopp.net \
    /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).