Skip to content

Commit 523c6b3

Browse files
zijun-hugregkh
authored andcommitted
driver core: Correct API device_for_each_child_reverse_from() prototype
For API device_for_each_child_reverse_from(..., const void *data, int (*fn)(struct device *dev, const void *data)) - Type of @DaTa is const pointer, and means caller's data @*data is not allowed to be modified, but that usually is not proper for such non finding device iterating API. - Types for both @DaTa and @fn are not consistent with all other for_each device iterating APIs device_for_each_child(_reverse)(), bus_for_each_dev() and (driver|class)_for_each_device(). Correct its prototype by removing const from parameter types, then adapt for various existing usages. An dedicated typedef device_iter_t will be introduced as @fn() type for various for_each device interating APIs later. Reviewed-by: Jonathan Cameron <[email protected]> Signed-off-by: Zijun Hu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 037116a commit 523c6b3

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

drivers/base/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4043,8 +4043,8 @@ EXPORT_SYMBOL_GPL(device_for_each_child_reverse);
40434043
* device_for_each_child_reverse_from();
40444044
*/
40454045
int device_for_each_child_reverse_from(struct device *parent,
4046-
struct device *from, const void *data,
4047-
int (*fn)(struct device *, const void *))
4046+
struct device *from, void *data,
4047+
int (*fn)(struct device *, void *))
40484048
{
40494049
struct klist_iter i;
40504050
struct device *child;

drivers/cxl/core/hdm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ static int cxl_decoder_commit(struct cxl_decoder *cxld)
703703
return 0;
704704
}
705705

706-
static int commit_reap(struct device *dev, const void *data)
706+
static int commit_reap(struct device *dev, void *data)
707707
{
708708
struct cxl_port *port = to_cxl_port(dev->parent);
709709
struct cxl_decoder *cxld;

drivers/cxl/core/region.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ static size_t show_targetN(struct cxl_region *cxlr, char *buf, int pos)
778778
return rc;
779779
}
780780

781-
static int check_commit_order(struct device *dev, const void *data)
781+
static int check_commit_order(struct device *dev, void *data)
782782
{
783783
struct cxl_decoder *cxld = to_cxl_decoder(dev);
784784

include/linux/device.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,8 +1079,8 @@ int device_for_each_child(struct device *parent, void *data,
10791079
int device_for_each_child_reverse(struct device *parent, void *data,
10801080
int (*fn)(struct device *dev, void *data));
10811081
int device_for_each_child_reverse_from(struct device *parent,
1082-
struct device *from, const void *data,
1083-
int (*fn)(struct device *, const void *));
1082+
struct device *from, void *data,
1083+
int (*fn)(struct device *, void *));
10841084
struct device *device_find_child(struct device *parent, const void *data,
10851085
device_match_t match);
10861086
struct device *device_find_child_by_name(struct device *parent,

0 commit comments

Comments
 (0)