Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPI: RIMT: Fix unused function warnings when CONFIG_IOMMU_API is disabled

When CONFIG_IOMMU_API is disabled, some functions defined outside its
conditional scope become unused, triggering compiler warnings reported
by the kernel test robot.

Move these function definitions inside the #ifdef CONFIG_IOMMU_API block
to prevent unused function warnings when the configuration is disabled.

Fixes: 8f7729552582 ("ACPI: RISC-V: Add support for RIMT")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202509280031.8Sjkr4bh-lkp@intel.com/
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Link: https://lore.kernel.org/r/20251013181947.261759-1-sunilvl@ventanamicro.com

authored by

Sunil V L and committed by
Paul Walmsley
e7b969cb ca525d53

+61 -61
+61 -61
drivers/acpi/riscv/rimt.c
··· 61 61 return 0; 62 62 } 63 63 64 - /** 65 - * rimt_get_fwnode() - Retrieve fwnode associated with an RIMT node 66 - * 67 - * @node: RIMT table node to be looked-up 68 - * 69 - * Returns: fwnode_handle pointer on success, NULL on failure 70 - */ 71 - static struct fwnode_handle *rimt_get_fwnode(struct acpi_rimt_node *node) 72 - { 73 - struct fwnode_handle *fwnode = NULL; 74 - struct rimt_fwnode *curr; 75 - 76 - spin_lock(&rimt_fwnode_lock); 77 - list_for_each_entry(curr, &rimt_fwnode_list, list) { 78 - if (curr->rimt_node == node) { 79 - fwnode = curr->fwnode; 80 - break; 81 - } 82 - } 83 - spin_unlock(&rimt_fwnode_lock); 84 - 85 - return fwnode; 86 - } 87 - 88 64 static acpi_status rimt_match_node_callback(struct acpi_rimt_node *node, 89 65 void *context) 90 66 { ··· 178 202 return NULL; 179 203 } 180 204 205 + /* 206 + * RISC-V supports IOMMU as a PCI device or a platform device. 207 + * When it is a platform device, there should be a namespace device as 208 + * well along with RIMT. To create the link between RIMT information and 209 + * the platform device, the IOMMU driver should register itself with the 210 + * RIMT module. This is true for PCI based IOMMU as well. 211 + */ 212 + int rimt_iommu_register(struct device *dev) 213 + { 214 + struct fwnode_handle *rimt_fwnode; 215 + struct acpi_rimt_node *node; 216 + 217 + node = rimt_scan_node(ACPI_RIMT_NODE_TYPE_IOMMU, dev); 218 + if (!node) { 219 + pr_err("Could not find IOMMU node in RIMT\n"); 220 + return -ENODEV; 221 + } 222 + 223 + if (dev_is_pci(dev)) { 224 + rimt_fwnode = acpi_alloc_fwnode_static(); 225 + if (!rimt_fwnode) 226 + return -ENOMEM; 227 + 228 + rimt_fwnode->dev = dev; 229 + if (!dev->fwnode) 230 + dev->fwnode = rimt_fwnode; 231 + 232 + rimt_set_fwnode(node, rimt_fwnode); 233 + } else { 234 + rimt_set_fwnode(node, dev->fwnode); 235 + } 236 + 237 + return 0; 238 + } 239 + 240 + #ifdef CONFIG_IOMMU_API 241 + 242 + /** 243 + * rimt_get_fwnode() - Retrieve fwnode associated with an RIMT node 244 + * 245 + * @node: RIMT table node to be looked-up 246 + * 247 + * Returns: fwnode_handle pointer on success, NULL on failure 248 + */ 249 + static struct fwnode_handle *rimt_get_fwnode(struct acpi_rimt_node *node) 250 + { 251 + struct fwnode_handle *fwnode = NULL; 252 + struct rimt_fwnode *curr; 253 + 254 + spin_lock(&rimt_fwnode_lock); 255 + list_for_each_entry(curr, &rimt_fwnode_list, list) { 256 + if (curr->rimt_node == node) { 257 + fwnode = curr->fwnode; 258 + break; 259 + } 260 + } 261 + spin_unlock(&rimt_fwnode_lock); 262 + 263 + return fwnode; 264 + } 265 + 181 266 static bool rimt_pcie_rc_supports_ats(struct acpi_rimt_node *node) 182 267 { 183 268 struct acpi_rimt_pcie_rc *pci_rc; ··· 326 289 327 290 return NULL; 328 291 } 329 - 330 - /* 331 - * RISC-V supports IOMMU as a PCI device or a platform device. 332 - * When it is a platform device, there should be a namespace device as 333 - * well along with RIMT. To create the link between RIMT information and 334 - * the platform device, the IOMMU driver should register itself with the 335 - * RIMT module. This is true for PCI based IOMMU as well. 336 - */ 337 - int rimt_iommu_register(struct device *dev) 338 - { 339 - struct fwnode_handle *rimt_fwnode; 340 - struct acpi_rimt_node *node; 341 - 342 - node = rimt_scan_node(ACPI_RIMT_NODE_TYPE_IOMMU, dev); 343 - if (!node) { 344 - pr_err("Could not find IOMMU node in RIMT\n"); 345 - return -ENODEV; 346 - } 347 - 348 - if (dev_is_pci(dev)) { 349 - rimt_fwnode = acpi_alloc_fwnode_static(); 350 - if (!rimt_fwnode) 351 - return -ENOMEM; 352 - 353 - rimt_fwnode->dev = dev; 354 - if (!dev->fwnode) 355 - dev->fwnode = rimt_fwnode; 356 - 357 - rimt_set_fwnode(node, rimt_fwnode); 358 - } else { 359 - rimt_set_fwnode(node, dev->fwnode); 360 - } 361 - 362 - return 0; 363 - } 364 - 365 - #ifdef CONFIG_IOMMU_API 366 292 367 293 static struct acpi_rimt_node *rimt_node_map_id(struct acpi_rimt_node *node, 368 294 u32 id_in, u32 *id_out,