Backports Archive on lore.kernel.org
 help / Atom feed
* .coredump spatch
@ 2018-09-17 21:39 Hauke Mehrtens
  2018-09-18  6:28 ` Omer Efrat
  2018-09-19  8:49 ` Johannes Berg
  0 siblings, 2 replies; 5+ messages in thread
From: Hauke Mehrtens @ 2018-09-17 21:39 UTC (permalink / raw)
  To: backports; +Cc: aspriel, Johannes Berg, John Crispin

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

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


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: .coredump spatch
  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
  2018-09-19  8:49 ` Johannes Berg
  1 sibling, 2 replies; 5+ messages in thread
From: Omer Efrat @ 2018-09-18  6:28 UTC (permalink / raw)
  To: Hauke Mehrtens, backports; +Cc: aspriel, Johannes Berg, John Crispin

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
>=20
> 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:
>=20
> static struct pci_driver brcmf_pciedrvr =3D {
> ....
>         .driver.coredump =3D brcmf_dev_coredump,
> };
>=20
> I would like to convert this to this:
>=20
> static struct pci_driver brcmf_pciedrvr =3D {
> ....
> #if LINUX_VERSION_IS_GEQ(4,16,0)
>         .driver.coredump =3D brcmf_dev_coredump,
> #endif
> };
>=20
> Hauke

I think you should have a look at 0075-ndo-stats-64.cocci for a good refere=
nce.

Omer.=
--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: .coredump spatch
  2018-09-18  6:28 ` Omer Efrat
@ 2018-09-18  6:28   ` Omer Efrat
  2018-09-18 21:49   ` Hauke Mehrtens
  1 sibling, 0 replies; 5+ messages in thread
From: Omer Efrat @ 2018-09-18  6:28 UTC (permalink / raw)
  To: Hauke Mehrtens, backports; +Cc: aspriel, Johannes Berg, John Crispin

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
>=20
> 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:
>=20
> static struct pci_driver brcmf_pciedrvr =3D {
> ....
>         .driver.coredump =3D brcmf_dev_coredump,
> };
>=20
> I would like to convert this to this:
>=20
> static struct pci_driver brcmf_pciedrvr =3D {
> ....
> #if LINUX_VERSION_IS_GEQ(4,16,0)
>         .driver.coredump =3D brcmf_dev_coredump,
> #endif
> };
>=20
> Hauke

I think you should have a look at 0075-ndo-stats-64.cocci for a good refere=
nce.

Omer.=

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: .coredump spatch
  2018-09-18  6:28 ` Omer Efrat
  2018-09-18  6:28   ` Omer Efrat
@ 2018-09-18 21:49   ` Hauke Mehrtens
  1 sibling, 0 replies; 5+ messages in thread
From: Hauke Mehrtens @ 2018-09-18 21:49 UTC (permalink / raw)
  To: Omer Efrat, backports; +Cc: aspriel, Johannes Berg, John Crispin

[-- 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 --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: .coredump spatch
  2018-09-17 21:39 .coredump spatch Hauke Mehrtens
  2018-09-18  6:28 ` Omer Efrat
@ 2018-09-19  8:49 ` Johannes Berg
  1 sibling, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2018-09-19  8:49 UTC (permalink / raw)
  To: Hauke Mehrtens, backports; +Cc: aspriel, John Crispin

On Mon, 2018-09-17 at 23:39 +0200, 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

How did you try? This seems to work for me:

@@
identifier drv, fn;
@@
static struct pci_driver drv = {
	.driver = {
+#if LINUX_VERSION_IS_GEQ(4,16,0)
		.coredump = fn,
+#endif
		...
	},
	...
};

@@
identifier drv, fn;
@@
 static struct pci_driver drv = {
+#if LINUX_VERSION_IS_GEQ(4,16,0)
	.driver.coredump = fn,
+#endif
	...
 };

johannes
--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2018-09-19  8:49 ` Johannes Berg

Backports Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/backports/0 backports/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 backports backports/ https://lore.kernel.org/backports \
		backports@vger.kernel.org backports@archiver.kernel.org
	public-inbox-index backports


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.backports


AGPL code for this site: git clone https://public-inbox.org/ public-inbox