Lines Matching +full:irq +full:- +full:device
1 // SPDX-License-Identifier: GPL-2.0
29 guard(mutex)(&auxdev->sysfs.lock); in auxiliary_irq_dir_prepare()
30 if (auxdev->sysfs.irq_dir_exists) in auxiliary_irq_dir_prepare()
33 ret = devm_device_add_group(&auxdev->dev, &auxiliary_irqs_group); in auxiliary_irq_dir_prepare()
37 auxdev->sysfs.irq_dir_exists = true; in auxiliary_irq_dir_prepare()
38 xa_init(&auxdev->sysfs.irqs); in auxiliary_irq_dir_prepare()
43 * auxiliary_device_sysfs_irq_add - add a sysfs entry for the given IRQ
44 * @auxdev: auxiliary bus device to add the sysfs entry.
45 * @irq: The associated interrupt number.
47 * This function should be called after auxiliary device have successfully
48 * received the irq.
49 * The driver is responsible to add a unique irq for the auxiliary device. The
52 * multiple times if the irq is already added previously.
56 int auxiliary_device_sysfs_irq_add(struct auxiliary_device *auxdev, int irq) in auxiliary_device_sysfs_irq_add() argument
59 struct device *dev = &auxdev->dev; in auxiliary_device_sysfs_irq_add()
68 return -ENOMEM; in auxiliary_device_sysfs_irq_add()
70 sysfs_attr_init(&info->sysfs_attr.attr); in auxiliary_device_sysfs_irq_add()
71 snprintf(info->name, AUXILIARY_MAX_IRQ_NAME, "%d", irq); in auxiliary_device_sysfs_irq_add()
73 ret = xa_insert(&auxdev->sysfs.irqs, irq, info, GFP_KERNEL); in auxiliary_device_sysfs_irq_add()
77 info->sysfs_attr.attr.name = info->name; in auxiliary_device_sysfs_irq_add()
78 ret = sysfs_add_file_to_group(&dev->kobj, &info->sysfs_attr.attr, in auxiliary_device_sysfs_irq_add()
83 xa_store(&auxdev->sysfs.irqs, irq, no_free_ptr(info), GFP_KERNEL); in auxiliary_device_sysfs_irq_add()
87 xa_erase(&auxdev->sysfs.irqs, irq); in auxiliary_device_sysfs_irq_add()
93 * auxiliary_device_sysfs_irq_remove - remove a sysfs entry for the given IRQ
94 * @auxdev: auxiliary bus device to add the sysfs entry.
95 * @irq: the IRQ to remove.
97 * This function should be called to remove an IRQ sysfs entry.
98 * The driver must invoke this API when IRQ is released by the device.
100 void auxiliary_device_sysfs_irq_remove(struct auxiliary_device *auxdev, int irq) in auxiliary_device_sysfs_irq_remove() argument
102 struct auxiliary_irq_info *info __free(kfree) = xa_load(&auxdev->sysfs.irqs, irq); in auxiliary_device_sysfs_irq_remove()
103 struct device *dev = &auxdev->dev; in auxiliary_device_sysfs_irq_remove()
106 dev_err(&auxdev->dev, "IRQ %d doesn't exist\n", irq); in auxiliary_device_sysfs_irq_remove()
109 sysfs_remove_file_from_group(&dev->kobj, &info->sysfs_attr.attr, in auxiliary_device_sysfs_irq_remove()
111 xa_erase(&auxdev->sysfs.irqs, irq); in auxiliary_device_sysfs_irq_remove()