From: Julian Calaby <julian.calaby@gmail.com>
To: Roland Vossen <rvossen@broadcom.com>
Cc: "gregkh@suse.de" <gregkh@suse.de>,
"devel@linuxdriverproject.org" <devel@linuxdriverproject.org>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH 44/83] staging: brcm80211: replaced typedef si_t with struct si_pub
Date: Mon, 6 Jun 2011 22:14:59 +1000 [thread overview]
Message-ID: <BANLkTin1Cv9L+mDDjXSPEPthPPX2uGtaVQ@mail.gmail.com> (raw)
In-Reply-To: <4DEC825A.2020404@broadcom.com>
On Mon, Jun 6, 2011 at 17:31, Roland Vossen <rvossen@broadcom.com> wrote:
> Hi Julian,
>
>>> I am afraid I have to disagree with you, for the reason that by including
>>> the header file you introduce unnecessary coupling. Let me elaborate. If
>>> a
>>> .c file does not need to know the contents of a struct, but it only needs
>>> to
>>> know that a pointer to an opaque struct, then one should not provide the
>>> C
>>> file with knowledge on the internals of the struct (hence not include the
>>> .h
>>> file).
>>
>> Fair enough. I guess I just don't like void pointers.
>
> Well, what I mean is this: suppose you have a function that gets a pointer
> to a struct as one of its parameters. This function calls another function
> with this parameter:
>
> void foo(struct *bar) {
> some_other_fnct(bar);
> }
>
> Then foo() simply passes the pointer on to some_other_fnct(), and foo() does
> not need to know about the members inside struct bar. So I am not talking
> about void pointers here as the alternative.
The reason I was pointing this out was that while foo() doesn't need
to know what's in struct bar, it will help type safety and general
code cleanliness to have some declaration of struct bar in the
headers.
If we have a module that exports a set of functions in it's header
file (say "bar.h") like:
extern struct bar *get_bar();
extern void foo(struct bar *bar);
the struct bar is part of the API of the module, even if no caller
ever uses it's internals. Therefore the header file should include the
line:
struct bar;
so that users of the API don't have to declare it themselves to
suppress the compiler warnings that would be generated otherwise.
My objection was to the struct declaration appearing at the top of
wl_iw.c, rather than in the header file that defines the functions
that use it.
In fact, looking a bit further around, it appears that this
declaration is already in aiutils.h making it's appearance at the top
of wl_iw.c completely redundant, especially given that the file in
question appears to not use *any* functions that use the struct, and
if it does, it should include aiutils.h rather than declaring the
struct itself - and this isn't introducing extra coupling, this is
merely including the header that defines the API for the code that
actually uses this struct.
Thanks,
--
Julian Calaby
Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
.Plan: http://sites.google.com/site/juliancalaby/
next prev parent reply other threads:[~2011-06-06 12:15 UTC|newest]
Thread overview: 115+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-01 11:44 [PATCH 01/83] staging: brcm80211: removed unused Broadcom specific ioctls codes Roland Vossen
2011-06-01 11:44 ` [PATCH 02/83] staging: brcm80211: removed iovar layer from softmac Roland Vossen
2011-06-01 11:44 ` [PATCH 03/83] staging: brcm80211: cleanup struct wl_info Roland Vossen
2011-06-01 11:44 ` [PATCH 04/83] staging: brcm80211: removed unused timeout fields in wlc_protection Roland Vossen
2011-06-01 11:44 ` [PATCH 05/83] staging: brcm80211: remove WLC_WATCHDOG_TBTT macro Roland Vossen
2011-06-01 11:44 ` [PATCH 06/83] staging: brcm80211: cleanup struct wlc_info definition Roland Vossen
2011-06-01 11:44 ` [PATCH 07/83] staging: brcm80211: fix compiler warning introduced Roland Vossen
2011-06-01 11:44 ` [PATCH 08/83] staging: brcm80211: replaced #ifdef __mips__ sections by W_REG_FLUSH Roland Vossen
2011-06-01 12:27 ` Jonas Gorski
2011-06-01 17:17 ` Roland Vossen
2011-06-01 11:44 ` [PATCH 09/83] staging: brcm80211: emptied wlioctl.h Roland Vossen
2011-06-01 11:44 ` [PATCH 10/83] staging: brcm80211: removed wlioctl.h and dhdioctl.h Roland Vossen
2011-06-01 11:44 ` [PATCH 11/83] staging: brcm80211: updated MAINTAINERS, README and TODO files Roland Vossen
2011-06-01 11:44 ` [PATCH 12/83] staging: brcm80211: remove iovars IOV_BLOCKMODE Roland Vossen
2011-06-01 11:44 ` [PATCH 13/83] staging: brcm80211: remove iovars IOV_DMA Roland Vossen
2011-06-01 11:44 ` [PATCH 14/83] staging: brcm80211: remove iovars IOV_NUMLOCALINTS Roland Vossen
2011-06-01 11:45 ` [PATCH 15/83] staging: brcm80211: remove iovars IOV_HOSTREG Roland Vossen
2011-06-01 11:45 ` [PATCH 16/83] staging: brcm80211: remove iovars IOV_DIVISOR Roland Vossen
2011-06-01 11:45 ` [PATCH 17/83] staging: brcm80211: remove iovars IOV_POWER Roland Vossen
2011-06-01 11:45 ` [PATCH 18/83] staging: brcm80211: remove iovars IOV_CLOCK Roland Vossen
2011-06-01 11:45 ` [PATCH 19/83] staging: brcm80211: remove iovars IOV_SDMODE Roland Vossen
2011-06-01 11:45 ` [PATCH 20/83] staging: brcm80211: remove iovars IOV_HISPEED Roland Vossen
2011-06-01 11:45 ` [PATCH 21/83] staging: brcm80211: added support for more bcm43224 based boards Roland Vossen
2011-06-01 11:45 ` [PATCH 22/83] staging: brcm80211: removed 'hnd' from filenames Roland Vossen
2011-06-01 11:45 ` [PATCH 23/83] staging: brcm80211: removed 'hnd' from everything but function names Roland Vossen
2011-06-01 11:45 ` [PATCH 24/83] staging: brcm80211: merged two header files into dhd_sdio.c Roland Vossen
2011-06-01 11:45 ` [PATCH 25/83] staging: brcm80211: removed unused stuff from proto/802.11.h Roland Vossen
2011-06-01 11:45 ` [PATCH 26/83] staging: brcm80211: emptied include/802.11.h Roland Vossen
2011-06-01 11:45 ` [PATCH 27/83] staging: brcm80211: removed 802.11.h Roland Vossen
2011-06-01 11:45 ` [PATCH 28/83] staging: brcm80211: cleaned bcmeth.h and bcmevent.h Roland Vossen
2011-06-01 11:45 ` [PATCH 29/83] staging: brcm80211: removed include/proto dir Roland Vossen
2011-06-01 11:45 ` [PATCH 30/83] staging: brcm80211: remove SDIO related definitions from nicpci.h Roland Vossen
2011-06-01 11:45 ` [PATCH 31/83] staging: brcm80211: remove usage of bcmsrom_tbl.h Roland Vossen
2011-06-01 11:45 ` [PATCH 32/83] staging: brcm80211: remove extern variable definitions in bcmsrom.c Roland Vossen
2011-06-01 11:45 ` [PATCH 33/83] staging: brcm80211: remove inclusion of bcmsrom_fmt.h Roland Vossen
2011-06-01 11:45 ` [PATCH 34/83] staging: brcm80211: cleaned sb* header files Roland Vossen
2011-06-01 11:45 ` [PATCH 35/83] staging: brcm80211: moved header files to more specific directory Roland Vossen
2011-06-02 0:08 ` Julian Calaby
2011-06-02 8:32 ` Arend van Spriel
2011-06-02 10:42 ` Julian Calaby
2011-06-01 11:45 ` [PATCH 36/83] staging: brcm80211: cleaned bcmdefs.h Roland Vossen
2011-06-01 11:45 ` [PATCH 37/83] staging: brcm80211: remove usage of pcicfg.h from brcmsmac driver Roland Vossen
2011-06-01 11:45 ` [PATCH 38/83] staging: brcm80211: move PCI related header files to appropriate driver folder Roland Vossen
2011-06-01 23:44 ` Julian Calaby
2011-06-01 11:45 ` [PATCH 39/83] staging: brcm80211: remove functions from nicpci.h Roland Vossen
2011-06-01 11:45 ` [PATCH 40/83] staging: brcm80211: remove unused functions from nicpci.c Roland Vossen
2011-06-01 11:45 ` [PATCH 41/83] staging: brcm80211: add braces to SI_INFO macro definition Roland Vossen
2011-06-01 11:45 ` [PATCH 42/83] staging: brcm80211: remove dependency on pci core difinitions from aiutils.c Roland Vossen
2011-06-01 23:18 ` Julian Calaby
2011-06-02 8:38 ` Arend van Spriel
2011-06-01 11:45 ` [PATCH 43/83] staging: brcm80211: remove pci core defintion files Roland Vossen
2011-06-01 11:45 ` [PATCH 44/83] staging: brcm80211: replaced typedef si_t with struct si_pub Roland Vossen
2011-06-01 23:58 ` Julian Calaby
2011-06-03 16:37 ` Roland Vossen
2011-06-04 0:51 ` Julian Calaby
2011-06-05 8:36 ` Roland Vossen
2011-06-05 9:20 ` Julian Calaby
2011-06-05 19:23 ` julie Sullivan
2011-06-06 1:34 ` Henry Ptasinski
2011-06-06 9:10 ` Roland Vossen
2011-06-06 7:31 ` Roland Vossen
2011-06-06 12:14 ` Julian Calaby [this message]
2011-06-08 12:20 ` Roland Vossen
2011-06-01 11:45 ` [PATCH 45/83] staging: brcm80211: deleted sbconfig.h, renamed sbcc.h Roland Vossen
2011-06-01 11:45 ` [PATCH 46/83] staging: brcm80211: moved sbdma.h into brcmsmac/bcmdma.h Roland Vossen
2011-06-01 11:45 ` [PATCH 47/83] staging: brcm80211: macro cleanup Roland Vossen
2011-06-01 11:45 ` [PATCH 48/83] staging: brcm80211: remove phy_version.h Roland Vossen
2011-06-01 11:45 ` [PATCH 49/83] staging: brcm80211: remove BCMEMBEDIMAGE related codes from fullmac Roland Vossen
2011-06-01 11:45 ` [PATCH 50/83] staging: brcm80211: absorb bcmcdc.h into dhd_cdc.c Roland Vossen
2011-06-01 23:37 ` Julian Calaby
2011-06-03 17:50 ` Franky Lin
2011-06-01 11:45 ` [PATCH 51/83] staging: brcm80211: clean up dhd.h in fullmac Roland Vossen
2011-06-01 11:45 ` [PATCH 52/83] staging: brcm80211: absorb bcmsdpcm.h " Roland Vossen
2011-06-01 11:45 ` [PATCH 53/83] staging: brcm80211: absorb msgtrace.h " Roland Vossen
2011-06-01 11:45 ` [PATCH 54/83] staging: brcm80211: combine sbsdpcmdev.h and sbsdio.h Roland Vossen
2011-06-01 23:22 ` Julian Calaby
2011-06-01 11:45 ` [PATCH 55/83] staging: brmc80211: remove sdio.h from fullmac Roland Vossen
2011-06-01 11:45 ` [PATCH 56/83] staging: brcm80211: remove sdioh.h " Roland Vossen
2011-06-01 11:45 ` [PATCH 57/83] staging: brcm80211: clean up wl_cfg80211.h in fullmac Roland Vossen
2011-06-01 11:45 ` [PATCH 58/83] staging: brcm80211: clean up wl_iw.h " Roland Vossen
2011-06-01 11:45 ` [PATCH 59/83] staging: brcm80211: removed wl_ (vendor specific acronym) Roland Vossen
2011-06-01 11:45 ` [PATCH 60/83] staging: brcm80211: renamed files to get rid of wl_ file name prefix Roland Vossen
2011-06-01 11:45 ` [PATCH 61/83] staging: brcm80211: removed wl_dbg.h Roland Vossen
2011-06-01 11:45 ` [PATCH 62/83] staging: brcm80211: removed wl_export.h Roland Vossen
2011-06-01 11:45 ` [PATCH 63/83] staging: brcm80211: removed unused code from bcmotp.c Roland Vossen
2011-06-01 11:45 ` [PATCH 64/83] staging: brcm80211: removed Broadcom specific acronym 'hnd' Roland Vossen
2011-06-01 11:45 ` [PATCH 65/83] staging: brcm80211: removed lmac remnants Roland Vossen
2011-06-01 11:45 ` [PATCH 66/83] staging: brcm80211: cleaned up prefix for utility functions Roland Vossen
2011-06-01 11:45 ` [PATCH 67/83] staging: brcm80211: renamed utility module related files Roland Vossen
2011-06-01 11:45 ` [PATCH 68/83] staging: brcm80211: remove nvram related source files Roland Vossen
2011-06-01 11:45 ` [PATCH 69/83] staging: brcm80211: removed OSL_WRITE_REG and OSL_READ_REG macros Roland Vossen
2011-06-01 11:45 ` [PATCH 70/83] staging: brcm80211: moved register read/write macro's Roland Vossen
2011-06-01 11:45 ` [PATCH 71/83] staging: brcm80211: further simplified register access macro's Roland Vossen
2011-06-02 2:45 ` Julian Calaby
2011-06-03 16:39 ` Roland Vossen
2011-06-01 11:45 ` [PATCH 72/83] staging: brcm80211: cleanup after R_REG/W_REG patches Roland Vossen
2011-06-01 11:45 ` [PATCH 73/83] staging: brcm80211: prepared header files for file rename Roland Vossen
2011-06-01 11:45 ` [PATCH 74/83] staging: brcm80211: renamed files in brcmsmac and include directories Roland Vossen
2011-06-01 11:46 ` [PATCH 75/83] staging: brcm80211: deleted header file include/aidmp.h Roland Vossen
2011-06-01 11:46 ` [PATCH 76/83] staging: brcm80211: cleaned include/brcm_hw_ids.h Roland Vossen
2011-06-01 11:46 ` [PATCH 77/83] staging: brcm80211: moved /include/sdio_host.h to /brcmfmac dir Roland Vossen
2011-06-01 11:46 ` [PATCH 78/83] staging: brcm80211: removed unused definitions from include/soc.h Roland Vossen
2011-06-01 11:46 ` [PATCH 79/83] staging: brcm80211: moved /include/srom.h into /brcmsmac dir Roland Vossen
2011-06-01 11:46 ` [PATCH 80/83] staging: brcm80211: deleted brcmsmac/cfg.h and brcmsmac/bsscfg.h Roland Vossen
2011-06-01 11:46 ` [PATCH 81/83] staging: brcm80211: removed keys.h Roland Vossen
2011-06-01 11:46 ` [PATCH 82/83] staging: brcm80211: renamed file Roland Vossen
2011-06-01 11:46 ` [PATCH 83/83] staging: brcm80211: updated TODO with current state of affairs Roland Vossen
2011-06-01 11:59 ` [PATCH 01/83] staging: brcm80211: removed unused Broadcom specific ioctls codes Rafał Miłecki
2011-06-01 16:23 ` Henry Ptasinski
2011-06-01 16:28 ` Rafał Miłecki
2011-06-02 3:06 ` Julian Calaby
2011-06-03 16:58 ` Roland Vossen
2011-06-04 0:54 ` Julian Calaby
2011-06-03 17:04 ` Henry Ptasinski
2011-06-04 1:00 ` Julian Calaby
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=BANLkTin1Cv9L+mDDjXSPEPthPPX2uGtaVQ@mail.gmail.com \
--to=julian.calaby@gmail.com \
--cc=devel@linuxdriverproject.org \
--cc=gregkh@suse.de \
--cc=linux-wireless@vger.kernel.org \
--cc=rvossen@broadcom.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;
as well as URLs for NNTP newsgroup(s).