forked from mirrors/linux
		
	firmware: arm_ffa: Split bus and driver into distinct modules
Make the FF-A bus on its own as a distinct module initialized at subsys_initcall level when builtin. Keep the FF-A driver core stack, together with any configured transport, in a different module initialized as module_init level. FF-A drivers initialization is now changed to module_init level. Acked-by: Sebastian Ene <sebastianene@google.com> Link: https://lore.kernel.org/r/20240515094028.1947976-2-sudeep.holla@arm.com Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
This commit is contained in:
		
							parent
							
								
									9dd15934f6
								
							
						
					
					
						commit
						18c250bd7e
					
				
					 4 changed files with 15 additions and 16 deletions
				
			
		| 
						 | 
					@ -2,5 +2,7 @@
 | 
				
			||||||
ffa-bus-y = bus.o
 | 
					ffa-bus-y = bus.o
 | 
				
			||||||
ffa-driver-y = driver.o
 | 
					ffa-driver-y = driver.o
 | 
				
			||||||
ffa-transport-$(CONFIG_ARM_FFA_SMCCC) += smccc.o
 | 
					ffa-transport-$(CONFIG_ARM_FFA_SMCCC) += smccc.o
 | 
				
			||||||
ffa-module-objs := $(ffa-bus-y) $(ffa-driver-y) $(ffa-transport-y)
 | 
					ffa-core-objs := $(ffa-bus-y)
 | 
				
			||||||
obj-$(CONFIG_ARM_FFA_TRANSPORT) = ffa-module.o
 | 
					ffa-module-objs := $(ffa-driver-y) $(ffa-transport-y)
 | 
				
			||||||
 | 
					obj-$(CONFIG_ARM_FFA_TRANSPORT)  = ffa-core.o
 | 
				
			||||||
 | 
					obj-$(CONFIG_ARM_FFA_TRANSPORT) += ffa-module.o
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -235,14 +235,21 @@ void ffa_device_unregister(struct ffa_device *ffa_dev)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
EXPORT_SYMBOL_GPL(ffa_device_unregister);
 | 
					EXPORT_SYMBOL_GPL(ffa_device_unregister);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int arm_ffa_bus_init(void)
 | 
					static int __init arm_ffa_bus_init(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return bus_register(&ffa_bus_type);
 | 
						return bus_register(&ffa_bus_type);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					subsys_initcall(arm_ffa_bus_init);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void arm_ffa_bus_exit(void)
 | 
					static void __exit arm_ffa_bus_exit(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	ffa_devices_unregister();
 | 
						ffa_devices_unregister();
 | 
				
			||||||
	bus_unregister(&ffa_bus_type);
 | 
						bus_unregister(&ffa_bus_type);
 | 
				
			||||||
	ida_destroy(&ffa_bus_id);
 | 
						ida_destroy(&ffa_bus_id);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					module_exit(arm_ffa_bus_exit);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					MODULE_ALIAS("ffa-core");
 | 
				
			||||||
 | 
					MODULE_AUTHOR("Sudeep Holla <sudeep.holla@arm.com>");
 | 
				
			||||||
 | 
					MODULE_DESCRIPTION("ARM FF-A bus");
 | 
				
			||||||
 | 
					MODULE_LICENSE("GPL");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,8 +14,6 @@ typedef struct arm_smccc_1_2_regs ffa_value_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef void (ffa_fn)(ffa_value_t, ffa_value_t *);
 | 
					typedef void (ffa_fn)(ffa_value_t, ffa_value_t *);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int arm_ffa_bus_init(void);
 | 
					 | 
				
			||||||
void arm_ffa_bus_exit(void);
 | 
					 | 
				
			||||||
bool ffa_device_is_valid(struct ffa_device *ffa_dev);
 | 
					bool ffa_device_is_valid(struct ffa_device *ffa_dev);
 | 
				
			||||||
void ffa_device_match_uuid(struct ffa_device *ffa_dev, const uuid_t *uuid);
 | 
					void ffa_device_match_uuid(struct ffa_device *ffa_dev, const uuid_t *uuid);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1608,14 +1608,9 @@ static int __init ffa_init(void)
 | 
				
			||||||
	if (ret)
 | 
						if (ret)
 | 
				
			||||||
		return ret;
 | 
							return ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = arm_ffa_bus_init();
 | 
					 | 
				
			||||||
	if (ret)
 | 
					 | 
				
			||||||
		return ret;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	drv_info = kzalloc(sizeof(*drv_info), GFP_KERNEL);
 | 
						drv_info = kzalloc(sizeof(*drv_info), GFP_KERNEL);
 | 
				
			||||||
	if (!drv_info) {
 | 
						if (!drv_info) {
 | 
				
			||||||
		ret = -ENOMEM;
 | 
							return -ENOMEM;
 | 
				
			||||||
		goto ffa_bus_exit;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = ffa_version_check(&drv_info->version);
 | 
						ret = ffa_version_check(&drv_info->version);
 | 
				
			||||||
| 
						 | 
					@ -1676,11 +1671,9 @@ static int __init ffa_init(void)
 | 
				
			||||||
	free_pages_exact(drv_info->rx_buffer, RXTX_BUFFER_SIZE);
 | 
						free_pages_exact(drv_info->rx_buffer, RXTX_BUFFER_SIZE);
 | 
				
			||||||
free_drv_info:
 | 
					free_drv_info:
 | 
				
			||||||
	kfree(drv_info);
 | 
						kfree(drv_info);
 | 
				
			||||||
ffa_bus_exit:
 | 
					 | 
				
			||||||
	arm_ffa_bus_exit();
 | 
					 | 
				
			||||||
	return ret;
 | 
						return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
subsys_initcall(ffa_init);
 | 
					module_init(ffa_init);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void __exit ffa_exit(void)
 | 
					static void __exit ffa_exit(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -1690,7 +1683,6 @@ static void __exit ffa_exit(void)
 | 
				
			||||||
	free_pages_exact(drv_info->tx_buffer, RXTX_BUFFER_SIZE);
 | 
						free_pages_exact(drv_info->tx_buffer, RXTX_BUFFER_SIZE);
 | 
				
			||||||
	free_pages_exact(drv_info->rx_buffer, RXTX_BUFFER_SIZE);
 | 
						free_pages_exact(drv_info->rx_buffer, RXTX_BUFFER_SIZE);
 | 
				
			||||||
	kfree(drv_info);
 | 
						kfree(drv_info);
 | 
				
			||||||
	arm_ffa_bus_exit();
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
module_exit(ffa_exit);
 | 
					module_exit(ffa_exit);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue