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
541};541};
542 542
543/**543/**
544 * regmap_add_irq_chip_np() - Use standard regmap IRQ controller handling544 * regmap_add_irq_chip_fwnode() - Use standard regmap IRQ controller handling
545 *545 *
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.
547 * @map: The regmap for the device.547 * @map: The regmap for the device.
548 * @irq: The IRQ the device uses to signal interrupts.548 * @irq: The IRQ the device uses to signal interrupts.
549 * @irq_flags: The IRQF_ flags to use for the primary interrupt.549 * @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
557 * register cache. The chip driver is responsible for restoring the557 * register cache. The chip driver is responsible for restoring the
558 * register values used by the IRQ controller over suspend and resume.558 * register values used by the IRQ controller over suspend and resume.
559 */559 */
560int regmap_add_irq_chip_np(struct device_node *np, struct regmap *map, int irq,560int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
561 int irq_flags, int irq_base,561 struct regmap *map, int irq,
562 const struct regmap_irq_chip *chip,562 int irq_flags, int irq_base,
563 struct regmap_irq_chip_data **data)563 const struct regmap_irq_chip *chip,
564 struct regmap_irq_chip_data **data)
564{565{
565 struct regmap_irq_chip_data *d;566 struct regmap_irq_chip_data *d;
566 int i;567 int i;
@@ -771,10 +772,12 @@ int regmap_add_irq_chip_np(struct device_node *np, struct regmap *map, int irq, · 204 unmodified lines
771 }772 }
772 773
773 if (irq_base)774 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,
775 0, &regmap_domain_ops, d);777 0, &regmap_domain_ops, d);
776 else778 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,
778 &regmap_domain_ops, d);781 &regmap_domain_ops, d);
779 if (!d->domain) {782 if (!d->domain) {
780 dev_err(map->dev, "Failed to create IRQ domain\n");783 dev_err(map->dev, "Failed to create IRQ domain\n");
@@ -808,7 +811,7 @@ err_alloc: · 27 unmodified lines
808 kfree(d);811 kfree(d);
809 return ret;812 return ret;
810}813}
811EXPORT_SYMBOL_GPL(regmap_add_irq_chip_np);814EXPORT_SYMBOL_GPL(regmap_add_irq_chip_fwnode);
812 815
813/**816/**
814 * regmap_add_irq_chip() - Use standard regmap IRQ controller handling817 * 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
822 *825 *
823 * Returns 0 on success or an errno on failure.826 * Returns 0 on success or an errno on failure.
824 *827 *
825 * This is the same as regmap_add_irq_chip_np, except that the device828 * This is the same as regmap_add_irq_chip_fwnode, except that the firmware
826 * node of the regmap is used.829 * node of the regmap is used.
827 */830 */
828int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,831int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
829 int irq_base, const struct regmap_irq_chip *chip,832 int irq_base, const struct regmap_irq_chip *chip,
830 struct regmap_irq_chip_data **data)833 struct regmap_irq_chip_data **data)
831{834{
832 return regmap_add_irq_chip_np(map->dev->of_node, map, irq, irq_flags,835 return regmap_add_irq_chip_fwnode(dev_fwnode(map->dev), map, irq,
833 irq_base, chip, data);836 irq_flags, irq_base, chip, data);
834}837}
835EXPORT_SYMBOL_GPL(regmap_add_irq_chip);838EXPORT_SYMBOL_GPL(regmap_add_irq_chip);
836 839
@@ -899,10 +902,10 @@ static int devm_regmap_irq_chip_match(struct device *dev, void *res, void *data) · 62 unmodified lines
899}902}
900 903
901/**904/**
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()
903 *906 *
904 * @dev: The device pointer on which irq_chip belongs to.907 * @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.
906 * @map: The regmap for the device.909 * @map: The regmap for the device.
907 * @irq: The IRQ the device uses to signal interrupts910 * @irq: The IRQ the device uses to signal interrupts
908 * @irq_flags: The IRQF_ flags to use for the primary interrupt.911 * @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
915 * The &regmap_irq_chip_data will be automatically released when the device is918 * The &regmap_irq_chip_data will be automatically released when the device is
916 * unbound.919 * unbound.
917 */920 */
918int devm_regmap_add_irq_chip_np(struct device *dev, struct device_node *np,921int devm_regmap_add_irq_chip_fwnode(struct device *dev,
919 struct regmap *map, int irq, int irq_flags,922 struct fwnode_handle *fwnode,
920 int irq_base,923 struct regmap *map, int irq,
921 const struct regmap_irq_chip *chip,924 int irq_flags, int irq_base,
922 struct regmap_irq_chip_data **data)925 const struct regmap_irq_chip *chip,
926 struct regmap_irq_chip_data **data)
923{927{
924 struct regmap_irq_chip_data **ptr, *d;928 struct regmap_irq_chip_data **ptr, *d;
925 int ret;929 int ret;
@@ -929,8 +933,8 @@ int devm_regmap_add_irq_chip_np(struct device *dev, struct device_node *np, · 3 unmodified lines
929 if (!ptr)933 if (!ptr)
930 return -ENOMEM;934 return -ENOMEM;
931 935
932 ret = regmap_add_irq_chip_np(np, map, irq, irq_flags, irq_base,936 ret = regmap_add_irq_chip_fwnode(fwnode, map, irq, irq_flags, irq_base,
933 chip, &d);937 chip, &d);
934 if (ret < 0) {938 if (ret < 0) {
935 devres_free(ptr);939 devres_free(ptr);
936 return ret;940 return ret;
@@ -941,7 +945,7 @@ int devm_regmap_add_irq_chip_np(struct device *dev, struct device_node *np, · 4 unmodified lines
941 *data = d;945 *data = d;
942 return 0;946 return 0;
943}947}
944EXPORT_SYMBOL_GPL(devm_regmap_add_irq_chip_np);948EXPORT_SYMBOL_GPL(devm_regmap_add_irq_chip_fwnode);
945 949
946/**950/**
947 * devm_regmap_add_irq_chip() - Resource manager regmap_add_irq_chip()951 * 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
964 const struct regmap_irq_chip *chip,968 const struct regmap_irq_chip *chip,
965 struct regmap_irq_chip_data **data)969 struct regmap_irq_chip_data **data)
966{970{
967 return devm_regmap_add_irq_chip_np(dev, map->dev->of_node, map, irq,971 return devm_regmap_add_irq_chip_fwnode(dev, dev_fwnode(map->dev), map,
968 irq_flags, irq_base, chip, data);972 irq, irq_flags, irq_base, chip,
973 data);
969}974}
970EXPORT_SYMBOL_GPL(devm_regmap_add_irq_chip);975EXPORT_SYMBOL_GPL(devm_regmap_add_irq_chip);
971 976
include/linux/regmap.h+12−9
@@ -18,6 +18,7 @@ · 17 unmodified lines
18#include <linux/bug.h>18#include <linux/bug.h>
19#include <linux/lockdep.h>19#include <linux/lockdep.h>
20#include <linux/iopoll.h>20#include <linux/iopoll.h>
21#include <linux/fwnode.h>
21 22
22struct module;23struct module;
23struct clk;24struct clk;
@@ -1311,21 +1312,23 @@ struct regmap_irq_chip_data; · 1287 unmodified lines
1311int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,1312int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
1312 int irq_base, const struct regmap_irq_chip *chip,1313 int irq_base, const struct regmap_irq_chip *chip,
1313 struct regmap_irq_chip_data **data);1314 struct regmap_irq_chip_data **data);
1314int regmap_add_irq_chip_np(struct device_node *np, struct regmap *map, int irq,1315int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
1315 int irq_flags, int irq_base,1316 struct regmap *map, int irq,
1316 const struct regmap_irq_chip *chip,1317 int irq_flags, int irq_base,
1317 struct regmap_irq_chip_data **data);1318 const struct regmap_irq_chip *chip,
1319 struct regmap_irq_chip_data **data);
1318void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data);1320void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data);
1319 1321
1320int devm_regmap_add_irq_chip(struct device *dev, struct regmap *map, int irq,1322int devm_regmap_add_irq_chip(struct device *dev, struct regmap *map, int irq,
1321 int irq_flags, int irq_base,1323 int irq_flags, int irq_base,
1322 const struct regmap_irq_chip *chip,1324 const struct regmap_irq_chip *chip,
1323 struct regmap_irq_chip_data **data);1325 struct regmap_irq_chip_data **data);
1324int devm_regmap_add_irq_chip_np(struct device *dev, struct device_node *np,1326int devm_regmap_add_irq_chip_fwnode(struct device *dev,
1325 struct regmap *map, int irq, int irq_flags,1327 struct fwnode_handle *fwnode,
1326 int irq_base,1328 struct regmap *map, int irq,
1327 const struct regmap_irq_chip *chip,1329 int irq_flags, int irq_base,
1328 struct regmap_irq_chip_data **data);1330 const struct regmap_irq_chip *chip,
1331 struct regmap_irq_chip_data **data);
1329void devm_regmap_del_irq_chip(struct device *dev, int irq,1332void devm_regmap_del_irq_chip(struct device *dev, int irq,
1330 struct regmap_irq_chip_data *data);1333 struct regmap_irq_chip_data *data);
1331 1334