backports.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hauke Mehrtens <hauke@hauke-m.de>
To: Omer Efrat <omer.efrat@tandemg.com>,
	"backports@vger.kernel.org" <backports@vger.kernel.org>
Cc: "aspriel@gmail.com" <aspriel@gmail.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	John Crispin <john@phrozen.org>
Subject: Re: .coredump spatch
Date: Tue, 18 Sep 2018 23:49:08 +0200	[thread overview]
Message-ID: <d37718aa-2741-09c4-d012-d8efff7c9066@hauke-m.de> (raw)
In-Reply-To: <VI1PR02MB3631D220BDE0C139F4369F769A1D0@VI1PR02MB3631.eurprd02.prod.outlook.com>


[-- Attachment #1.1: Type: text/plain, Size: 1492 bytes --]

On 09/18/2018 08:28 AM, Omer Efrat wrote:
> On Tue, Sep 18, 2018, Hauke Mehrtens wrote:
> 
>> The device structure now has this .coredump member which is also used by
>> some wireless drivers, see here for example:
>> https://git.kernel.org/linus/8e072168f75ebce85b96cbcefea2b10ddbd5913f
>>
>> I tried to create a spatch for this, but I failed to match the driver
>> member because it is embedded inside an other structure, it looks like
>> this for example:
>>
>> static struct pci_driver brcmf_pciedrvr = {
>> ....
>>         .driver.coredump = brcmf_dev_coredump,
>> };
>>
>> I would like to convert this to this:
>>
>> static struct pci_driver brcmf_pciedrvr = {
>> ....
>> #if LINUX_VERSION_IS_GEQ(4,16,0)
>>         .driver.coredump = brcmf_dev_coredump,
>> #endif
>> };
>>
>> Hauke
> 
> I think you should have a look at 0075-ndo-stats-64.cocci for a good reference.
> 
> Omer.
> 
Hi Omer,

Thanks for the hint, but I already tried something like that.
The suggested code looks like this:

struct net_device_ops OPS@p = {
+#if LINUX_VERSION_IS_GEQ(4,11,0)
	.ndo_get_stats64 = stats64_fn,
+#else
+	.ndo_get_stats64 = stats64_fn_wrap,
+#endif
};

This directly uses a member of a structure, but the .coredump is in a
structure which is embedded in a different structure like this:

struct pci_driver {
...
	struct device_driver	driver;
...
};

struct device_driver {
...
	void (*coredump) (struct device *dev);
...
};

Hauke


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

  parent reply	other threads:[~2018-09-19  3:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-17 21:39 .coredump spatch Hauke Mehrtens
2018-09-18  6:28 ` Omer Efrat
2018-09-18  6:28   ` Omer Efrat
2018-09-18 21:49   ` Hauke Mehrtens [this message]
2018-09-19  8:49 ` 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=d37718aa-2741-09c4-d012-d8efff7c9066@hauke-m.de \
    --to=hauke@hauke-m.de \
    --cc=aspriel@gmail.com \
    --cc=backports@vger.kernel.org \
    --cc=johannes@sipsolutions.net \
    --cc=john@phrozen.org \
    --cc=omer.efrat@tandemg.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).