analogdevicesinc / no-OS

Software drivers in C for systems without an operating system
http://analogdevicesinc.github.io/no-OS/
Other
922 stars 1.65k forks source link

drivers: platform: maxim: Fix irq_desc removal #2223

Closed CiprianRegus closed 3 months ago

CiprianRegus commented 3 months ago

Currently, there may be multiple interrupt controllers allocated, even though there is only one hardware instance (NVIC). The issue is that is no_os_irq_ctrl_remove() is called for an interrupt controller with ref = 0, all the callback functions will be removed, even those which were registered using another controller.

Fix this by turning the interrupt controller into a shared reference, thus max_irq_ctrl_remove() will only be called once ref = 0.

Pull Request Description

Please replace this with a detailed description and motivation of the changes. You can tick the checkboxes below with an 'x' between square brackets or just check them after publishing the PR. If this PR contains a breaking change, list dependent PRs and try to push all related PRs at the same time.

PR Type

PR Checklist