linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Roskin <proski@gnu.org>
To: Hauke Mehrtens <hauke@hauke-m.de>
Cc: lrodriguez@atheros.com, linux-wireless@vger.kernel.org,
	mcgrof@infradead.org
Subject: Re: [PATCH 2/2] compat-wireless: fix use of device_create
Date: Tue, 06 Apr 2010 17:03:35 -0400	[thread overview]
Message-ID: <1270587815.31184.4.camel@mj> (raw)
In-Reply-To: <1270501410-3956-2-git-send-email-hauke@hauke-m.de>

On Mon, 2010-04-05 at 23:03 +0200, Hauke Mehrtens wrote: 
> The signature of device_create changed in the last kernel version.
> Backporting it in compat is hard because of the use of var args.

I see it's applied already, but I hope some belated critique could be
useful anyway.

The log mentions "last kernel version", but the patch affects Linux
2.6.26 and older.  Either the log is wrong (more likely), or the
implementation doesn't include something that it was meant to do.

> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
> + 		data->dev = device_create(hwsim_class, NULL, 0, hw,
> + 					  "hwsim%d", i);
> ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26))
> ++		data->dev = device_create_drvdata(hwsim_class, NULL, 0, hw,
> ++					  "hwsim%d", i);
> ++#else
> ++		data->dev = device_create(hwsim_class, NULL, 0,
> ++					  "hwsim%d", i);
> ++		dev_set_drvdata(data->dev, hw);
> ++#endif

Linux 2.6.26 should be able to use exactly the same code as the older
kernels.  It has device_create() with the old signature and
dev_set_drvdata().  I'd rather avoid extra complexity.

Also, it should be possible to redefine device_create() for older
kernels using a macro:

#define device_create(cls, parent, devt, drvdata, fmt, ...)            \
({                                                                     \
       struct device *_dev;                                            \
       _dev = (device_create)(cls, parent, devt, fmt, __VA_ARGS__);    \
       dev_set_drvdata(_dev, drvdata);                                 \
       _dev;                                                           \
})

-- 
Regards,
Pavel Roskin

      parent reply	other threads:[~2010-04-06 21:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-05 21:03 [PATCH 1/2] compat-wireless: Backport changes in pcmcia system Hauke Mehrtens
2010-04-05 21:03 ` [PATCH 2/2] compat-wireless: fix use of device_create Hauke Mehrtens
2010-04-05 21:23   ` Luis R. Rodriguez
2010-04-06 21:03   ` Pavel Roskin [this message]

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=1270587815.31184.4.camel@mj \
    --to=proski@gnu.org \
    --cc=hauke@hauke-m.de \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lrodriguez@atheros.com \
    --cc=mcgrof@infradead.org \
    /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).