linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Johannes Berg <johannes@sipsolutions.net>,
	Ola Olsson <ola1olsson@gmail.com>
Cc: "ola. olsson" <ola.olsson@sonymobile.com>,
	linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH] Print warnings for missing cfg80211_ops implementations
Date: Thu, 17 Dec 2015 03:01:46 -0800	[thread overview]
Message-ID: <1450350106.3430.5.camel@perches.com> (raw)
In-Reply-To: <1450339048.8247.19.camel@sipsolutions.net>

On Thu, 2015-12-17 at 08:57 +0100, Johannes Berg wrote:
> On Thu, 2015-12-17 at 08:34 +0100, Ola Olsson wrote:
> > > but maybe it should be
> > > 
> > >         WARN_ON((ops->add_station && !ops->del_station) ||
> > >                 (!opt->add_station && ops->del_station))
> > > 
> > > etc...
> > 
> > Ahh, got it! I really like your idea but I assume it's quite rare to
> > implement the "stop/del/leave/disconnect" callbacks and at the same
> > time forget to implement the "start/add/join/connect". You will
> > probably find out pretty quickly if the "start" functions are
> > missing,
> > while it might take some time debugging why you lack the "stop"
> > functions (reinitialization issues/ resource leaks for example).
> > 
> > With that said, don't take my word for it, I was only following the
> > existing pattern and I assume someone else had a good reason in the
> > first place.
> > 
> 
> Pretty much what you said :)

Following patterns is good, I just think the
pattern could be trivially improved.

The test is a runtime check on what would ideally
be done at compile time.

Using
	WARN_ON(!a ^ !b)
which is logically the same as what I wrote above
for clarity is simply a bit more coverage and maybe
even a bit run-time faster.



  reply	other threads:[~2015-12-17 11:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-16 21:43 [PATCH] Print warnings for missing cfg80211_ops implementations Ola Olsson
2015-12-17  1:16 ` Joe Perches
     [not found]   ` <CABAco3BSaB9R6-nZQsmOnfXXy2ra-un0jjeBkyq4inzCybD5dw@mail.gmail.com>
2015-12-17  5:19     ` Joe Perches
2015-12-17  7:34       ` Ola Olsson
2015-12-17  7:57         ` Johannes Berg
2015-12-17 11:01           ` Joe Perches [this message]
2015-12-17 11:43             ` Ola Olsson
2015-12-17 12:43             ` Johannes Berg

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=1450350106.3430.5.camel@perches.com \
    --to=joe@perches.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=ola.olsson@sonymobile.com \
    --cc=ola1olsson@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;
as well as URLs for NNTP newsgroup(s).