backports: transform group attribute backport to SmPL form

The struct attribute_group collateral evolution by Greg and Oliver
was introduced as of v3.11:

mcgrof@ergon ~/linux (git::master)$ git describe --contains f2f37f58b
mcgrof@ergon ~/linux (git::master)$ git describe --contains 3493f69f4

We backport them with our own respective set of helpers. Each new data
structure that gets an attribute group needs a respective SmPL set of
rules for the transformation, specially if they were introduced in
different kernel versions, which in this case we have two which were.
By using SmPL we can automatically backport the collateral evolutions
moving forward for *any* driver that makes use of these group
attributes on both data structure we are addressing in these SmPL
patches. This is a great example of the level of atomicity that we
want to ideally strive to reach for backporting, as it lets us
automatically backport a collateral evolution through grammer for
*any* device driver we backport, and lets us be lazier.

We provided backports of introduction of the group attribute onto
two data structures:

  * struct class: added via commit d05a6f96c
  * struct bus_type: added via commit fa6fdb33b

mcgrof@ergon ~/linux (git::master)$ git describe --contains d05a6f96c

mcgrof@ergon ~/linux (git::master)$ git describe --contains fa6fdb33b

This patch generalizes the backport the introduction of the group
attribute to each data structure into separate SmPL patch files.
One change the SmPL patches pick up on was #ifdef'ing over the
init_foogroup_attrs() calls which would only have been introduced when
ATTRIBUTE_GROUPS_BACKPORT() was used, which *is* #idefd's.

The changes that added the new APIs are below, the respective commits
for each data structure change are documented on each SmPL patch.

commit f2f37f58b1b933b06d6d84e80a31a1b500fb0db2
Author: Greg Kroah-Hartman <>
Date:   Sun Jul 14 16:05:52 2013 -0700

    sysfs.h: add ATTRIBUTE_GROUPS() macro

    To make it easier for driver subsystems to work with attribute groups,
    create the ATTRIBUTE_GROUPS macro to remove some of the repetitive
    typing for the most common use for attribute groups.

    Reviewed-by: Guenter Roeck <>
    Tested-by: Guenter Roeck <>
    Signed-off-by: Greg Kroah-Hartman <>

commit 3493f69f4c4e8703961919a9a56c2d2e6a25b46f
Author: Oliver Schinagl <>
Date:   Sun Jul 14 16:05:59 2013 -0700

    sysfs: add more helper macro's for (bin_)attribute(_groups)

    With the recent changes to sysfs there's various helper macro's.
    However there's no RW, RO BIN_ helper macro's. This patch adds them.

    Signed-off-by: Oliver Schinagl <>
    Signed-off-by: Greg Kroah-Hartman <>

mcgrof@drvbp1 ~/backports (git::master)$ time \
	./ --clean /home/mcgrof/linux-next /home/mcgrof/build/next-20140411
Copy original source files ...
Apply patches ...
Modify Kconfig tree ...
Rewrite Makefiles and Kconfig files ...

real    1m14.635s
user    5m17.308s
sys     0m39.216s

== ckmake-report.log ==

1   3.0.101             [  OK  ]
2   3.1.10              [  OK  ]
3   3.2.54              [  OK  ]
4   3.3.8               [  OK  ]
5   3.4.79              [  OK  ]
6   3.5.7               [  OK  ]
7   3.6.11              [  OK  ]
8   3.7.10              [  OK  ]
9   3.8.13              [  OK  ]
10  3.9.11              [  OK  ]
11  3.10.29             [  OK  ]
12  3.11.10             [  OK  ]
13  3.12.10             [  OK  ]
14  3.13.2              [  OK  ]
15  3.14-rc1            [  OK  ]

real    28m18.533s
user    785m28.844s
sys     86m25.548s

Cc: Peter Senna <>
Cc: Julia Lawall <>
Cc: Gilles Muller <>
Cc: Greg Kroah-Hartman <>
Cc: Oliver Schinagl <>
Signed-off-by: Luis R. Rodriguez <>
8 files changed