History

regmap-irq: use fwnode instead of device node in add_irq_chip()

Convert the argument to the newer fwnode_handle instead a device tree node. Fortunately, there are no users for now. So this is an easy change.

Michael Walle committed 6 years ago

Commit 5cc20131 parent b3a9e3b2 files · +41 −33Browse files

Unified · Split

2 files
  1. drivers/base/regmap/regmap-irq.c +29 −24
  2. include/linux/regmap.h +12 −9
drivers/base/regmap/regmap-irq.c+29−24
@@ -541,9 +541,9 @@ static const struct irq_domain_ops regmap_domain_ops = { · 540 unmodified lines
541541 };
542542
543543 /**
544− * regmap_add_irq_chip_np() - Use standard regmap IRQ controller handling
544+ * regmap_add_irq_chip_fwnode() - Use standard regmap IRQ controller handling
545545 *
546− * @np: The device_node where the IRQ domain should be added to.
546+ * @fwnode: The firmware node where the IRQ domain should be added to.
547547 * @map: The regmap for the device.
548548 * @irq: The IRQ the device uses to signal interrupts.
549549 * @irq_flags: The IRQF_ flags to use for the primary interrupt.
@@ -557,10 +557,11 @@ static const struct irq_domain_ops regmap_domain_ops = { · 7 unmodified lines
557557 * register cache. The chip driver is responsible for restoring the
558558 * register values used by the IRQ controller over suspend and resume.
559559 */
560−int regmap_add_irq_chip_np(struct device_node *np, struct regmap *map, int irq,
561− int irq_flags, int irq_base,
562− const struct regmap_irq_chip *chip,
563− struct regmap_irq_chip_data **data)
560+int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
561+ struct regmap *map, int irq,
562+ int irq_flags, int irq_base,
563+ const struct regmap_irq_chip *chip,
564+ struct regmap_irq_chip_data **data)
564565 {
565566 struct regmap_irq_chip_data *d;
566567 int i;
@@ -771,10 +772,12 @@ int regmap_add_irq_chip_np(struct device_node *np, struct regmap *map, int irq, · 204 unmodified lines
771772 }
772773
773774 if (irq_base)
774− d->domain = irq_domain_add_legacy(np, chip->num_irqs, irq_base,
775+ d->domain = irq_domain_add_legacy(to_of_node(fwnode),
776+ chip->num_irqs, irq_base,
775777 0, &regmap_domain_ops, d);
776778 else
777− d->domain = irq_domain_add_linear(np, chip->num_irqs,
779+ d->domain = irq_domain_add_linear(to_of_node(fwnode),
780+ chip->num_irqs,
778781 &regmap_domain_ops, d);
779782 if (!d->domain) {
780783 dev_err(map->dev, "Failed to create IRQ domain\n");
@@ -808,7 +811,7 @@ err_alloc: · 27 unmodified lines
808811 kfree(d);
809812 return ret;
810813 }
811−EXPORT_SYMBOL_GPL(regmap_add_irq_chip_np);
814+EXPORT_SYMBOL_GPL(regmap_add_irq_chip_fwnode);
812815
813816 /**
814817 * regmap_add_irq_chip() - Use standard regmap IRQ controller handling
@@ -822,15 +825,15 @@ EXPORT_SYMBOL_GPL(regmap_add_irq_chip_np); · 7 unmodified lines
822825 *
823826 * Returns 0 on success or an errno on failure.
824827 *
825− * This is the same as regmap_add_irq_chip_np, except that the device
828+ * This is the same as regmap_add_irq_chip_fwnode, except that the firmware
826829 * node of the regmap is used.
827830 */
828831 int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
829832 int irq_base, const struct regmap_irq_chip *chip,
830833 struct regmap_irq_chip_data **data)
831834 {
832− return regmap_add_irq_chip_np(map->dev->of_node, map, irq, irq_flags,
833− irq_base, chip, data);
835+ return regmap_add_irq_chip_fwnode(dev_fwnode(map->dev), map, irq,
836+ irq_flags, irq_base, chip, data);
834837 }
835838 EXPORT_SYMBOL_GPL(regmap_add_irq_chip);
836839
@@ -899,10 +902,10 @@ static int devm_regmap_irq_chip_match(struct device *dev, void *res, void *data) · 62 unmodified lines
899902 }
900903
901904 /**
902− * devm_regmap_add_irq_chip_np() - Resource manager regmap_add_irq_chip_np()
905+ * devm_regmap_add_irq_chip_fwnode() - Resource managed regmap_add_irq_chip_fwnode()
903906 *
904907 * @dev: The device pointer on which irq_chip belongs to.
905− * @np: The device_node where the IRQ domain should be added to.
908+ * @fwnode: The firmware node where the IRQ domain should be added to.
906909 * @map: The regmap for the device.
907910 * @irq: The IRQ the device uses to signal interrupts
908911 * @irq_flags: The IRQF_ flags to use for the primary interrupt.
@@ -915,11 +918,12 @@ static int devm_regmap_irq_chip_match(struct device *dev, void *res, void *data) · 6 unmodified lines
915918 * The &regmap_irq_chip_data will be automatically released when the device is
916919 * unbound.
917920 */
918−int devm_regmap_add_irq_chip_np(struct device *dev, struct device_node *np,
919− struct regmap *map, int irq, int irq_flags,
920− int irq_base,
921− const struct regmap_irq_chip *chip,
922− struct regmap_irq_chip_data **data)
921+int devm_regmap_add_irq_chip_fwnode(struct device *dev,
922+ struct fwnode_handle *fwnode,
923+ struct regmap *map, int irq,
924+ int irq_flags, int irq_base,
925+ const struct regmap_irq_chip *chip,
926+ struct regmap_irq_chip_data **data)
923927 {
924928 struct regmap_irq_chip_data **ptr, *d;
925929 int ret;
@@ -929,8 +933,8 @@ int devm_regmap_add_irq_chip_np(struct device *dev, struct device_node *np, · 3 unmodified lines
929933 if (!ptr)
930934 return -ENOMEM;
931935
932− ret = regmap_add_irq_chip_np(np, map, irq, irq_flags, irq_base,
933− chip, &d);
936+ ret = regmap_add_irq_chip_fwnode(fwnode, map, irq, irq_flags, irq_base,
937+ chip, &d);
934938 if (ret < 0) {
935939 devres_free(ptr);
936940 return ret;
@@ -941,7 +945,7 @@ int devm_regmap_add_irq_chip_np(struct device *dev, struct device_node *np, · 4 unmodified lines
941945 *data = d;
942946 return 0;
943947 }
944−EXPORT_SYMBOL_GPL(devm_regmap_add_irq_chip_np);
948+EXPORT_SYMBOL_GPL(devm_regmap_add_irq_chip_fwnode);
945949
946950 /**
947951 * devm_regmap_add_irq_chip() - Resource manager regmap_add_irq_chip()
@@ -964,8 +968,9 @@ int devm_regmap_add_irq_chip(struct device *dev, struct regmap *map, int irq, · 16 unmodified lines
964968 const struct regmap_irq_chip *chip,
965969 struct regmap_irq_chip_data **data)
966970 {
967− return devm_regmap_add_irq_chip_np(dev, map->dev->of_node, map, irq,
968− irq_flags, irq_base, chip, data);
971+ return devm_regmap_add_irq_chip_fwnode(dev, dev_fwnode(map->dev), map,
972+ irq, irq_flags, irq_base, chip,
973+ data);
969974 }
970975 EXPORT_SYMBOL_GPL(devm_regmap_add_irq_chip);
971976
include/linux/regmap.h+12−9
@@ -18,6 +18,7 @@ · 17 unmodified lines
1818 #include <linux/bug.h>
1919 #include <linux/lockdep.h>
2020 #include <linux/iopoll.h>
21+#include <linux/fwnode.h>
2122
2223 struct module;
2324 struct clk;
@@ -1311,21 +1312,23 @@ struct regmap_irq_chip_data; · 1287 unmodified lines
13111312 int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
13121313 int irq_base, const struct regmap_irq_chip *chip,
13131314 struct regmap_irq_chip_data **data);
1314−int regmap_add_irq_chip_np(struct device_node *np, struct regmap *map, int irq,
1315− int irq_flags, int irq_base,
1316− const struct regmap_irq_chip *chip,
1317− struct regmap_irq_chip_data **data);
1315+int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
1316+ struct regmap *map, int irq,
1317+ int irq_flags, int irq_base,
1318+ const struct regmap_irq_chip *chip,
1319+ struct regmap_irq_chip_data **data);
13181320 void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data);
13191321
13201322 int devm_regmap_add_irq_chip(struct device *dev, struct regmap *map, int irq,
13211323 int irq_flags, int irq_base,
13221324 const struct regmap_irq_chip *chip,
13231325 struct regmap_irq_chip_data **data);
1324−int devm_regmap_add_irq_chip_np(struct device *dev, struct device_node *np,
1325− struct regmap *map, int irq, int irq_flags,
1326− int irq_base,
1327− const struct regmap_irq_chip *chip,
1328− struct regmap_irq_chip_data **data);
1326+int devm_regmap_add_irq_chip_fwnode(struct device *dev,
1327+ struct fwnode_handle *fwnode,
1328+ struct regmap *map, int irq,
1329+ int irq_flags, int irq_base,
1330+ const struct regmap_irq_chip *chip,
1331+ struct regmap_irq_chip_data **data);
13291332 void devm_regmap_del_irq_chip(struct device *dev, int irq,
13301333 struct regmap_irq_chip_data *data);
13311334