Commit 5be35f7f authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'pnp-5.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull PNP cleanup from Rafael Wysocki:
 "Make the PNP code use list_for_each_entry() in a few places instead of
  open-coding it (Jason Gunthorpe)"

* tag 'pnp-5.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  pnp: Use list_for_each_entry() instead of open coding
parents 9dc5d985 01b2bafe
...@@ -220,10 +220,8 @@ struct pnp_card { ...@@ -220,10 +220,8 @@ struct pnp_card {
#define global_to_pnp_card(n) list_entry(n, struct pnp_card, global_list) #define global_to_pnp_card(n) list_entry(n, struct pnp_card, global_list)
#define protocol_to_pnp_card(n) list_entry(n, struct pnp_card, protocol_list) #define protocol_to_pnp_card(n) list_entry(n, struct pnp_card, protocol_list)
#define to_pnp_card(n) container_of(n, struct pnp_card, dev) #define to_pnp_card(n) container_of(n, struct pnp_card, dev)
#define pnp_for_each_card(card) \ #define pnp_for_each_card(card) \
for((card) = global_to_pnp_card(pnp_cards.next); \ list_for_each_entry(card, &pnp_cards, global_list)
(card) != global_to_pnp_card(&pnp_cards); \
(card) = global_to_pnp_card((card)->global_list.next))
struct pnp_card_link { struct pnp_card_link {
struct pnp_card *card; struct pnp_card *card;
...@@ -276,14 +274,9 @@ struct pnp_dev { ...@@ -276,14 +274,9 @@ struct pnp_dev {
#define card_to_pnp_dev(n) list_entry(n, struct pnp_dev, card_list) #define card_to_pnp_dev(n) list_entry(n, struct pnp_dev, card_list)
#define protocol_to_pnp_dev(n) list_entry(n, struct pnp_dev, protocol_list) #define protocol_to_pnp_dev(n) list_entry(n, struct pnp_dev, protocol_list)
#define to_pnp_dev(n) container_of(n, struct pnp_dev, dev) #define to_pnp_dev(n) container_of(n, struct pnp_dev, dev)
#define pnp_for_each_dev(dev) \ #define pnp_for_each_dev(dev) list_for_each_entry(dev, &pnp_global, global_list)
for((dev) = global_to_pnp_dev(pnp_global.next); \ #define card_for_each_dev(card, dev) \
(dev) != global_to_pnp_dev(&pnp_global); \ list_for_each_entry(dev, &(card)->devices, card_list)
(dev) = global_to_pnp_dev((dev)->global_list.next))
#define card_for_each_dev(card,dev) \
for((dev) = card_to_pnp_dev((card)->devices.next); \
(dev) != card_to_pnp_dev(&(card)->devices); \
(dev) = card_to_pnp_dev((dev)->card_list.next))
#define pnp_dev_name(dev) (dev)->name #define pnp_dev_name(dev) (dev)->name
static inline void *pnp_get_drvdata(struct pnp_dev *pdev) static inline void *pnp_get_drvdata(struct pnp_dev *pdev)
...@@ -437,14 +430,10 @@ struct pnp_protocol { ...@@ -437,14 +430,10 @@ struct pnp_protocol {
}; };
#define to_pnp_protocol(n) list_entry(n, struct pnp_protocol, protocol_list) #define to_pnp_protocol(n) list_entry(n, struct pnp_protocol, protocol_list)
#define protocol_for_each_card(protocol,card) \ #define protocol_for_each_card(protocol, card) \
for((card) = protocol_to_pnp_card((protocol)->cards.next); \ list_for_each_entry(card, &(protocol)->cards, protocol_list)
(card) != protocol_to_pnp_card(&(protocol)->cards); \ #define protocol_for_each_dev(protocol, dev) \
(card) = protocol_to_pnp_card((card)->protocol_list.next)) list_for_each_entry(dev, &(protocol)->devices, protocol_list)
#define protocol_for_each_dev(protocol,dev) \
for((dev) = protocol_to_pnp_dev((protocol)->devices.next); \
(dev) != protocol_to_pnp_dev(&(protocol)->devices); \
(dev) = protocol_to_pnp_dev((dev)->protocol_list.next))
extern struct bus_type pnp_bus_type; extern struct bus_type pnp_bus_type;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment