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

Configure Feed

Select the types of activity you want to include in your feed.

misc: fastrpc: Cleanup the domain names

Currently the domain ids are added for each instance of domains, this is
totally not scalable approach. Clean this mess and create domain ids for
only domains not its instances.

Co-developed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Ekansh Gupta <ekansh.gupta@oss.qualcomm.com>
Signed-off-by: Ling Xu <quic_lxu5@quicinc.com>
Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
Link: https://lore.kernel.org/r/20250912131302.303199-4-srini@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Ling Xu and committed by
Greg Kroah-Hartman
fb4679f6 d81c041e

+20 -16
+20 -16
drivers/misc/fastrpc.c
··· 27 27 #define MDSP_DOMAIN_ID (1) 28 28 #define SDSP_DOMAIN_ID (2) 29 29 #define CDSP_DOMAIN_ID (3) 30 - #define CDSP1_DOMAIN_ID (4) 31 - #define FASTRPC_DEV_MAX 5 /* adsp, mdsp, slpi, cdsp, cdsp1 */ 32 30 #define FASTRPC_MAX_SESSIONS 14 33 31 #define FASTRPC_MAX_VMIDS 16 34 32 #define FASTRPC_ALIGN 128 ··· 104 106 105 107 #define miscdev_to_fdevice(d) container_of(d, struct fastrpc_device, miscdev) 106 108 107 - static const char *domains[FASTRPC_DEV_MAX] = { "adsp", "mdsp", 108 - "sdsp", "cdsp", "cdsp1" }; 109 109 struct fastrpc_phy_page { 110 110 u64 addr; /* physical address */ 111 111 u64 size; /* size of contiguous region */ ··· 2239 2243 return err; 2240 2244 } 2241 2245 2246 + static int fastrpc_get_domain_id(const char *domain) 2247 + { 2248 + if (!strncmp(domain, "adsp", 4)) 2249 + return ADSP_DOMAIN_ID; 2250 + else if (!strncmp(domain, "cdsp", 4)) 2251 + return CDSP_DOMAIN_ID; 2252 + else if (!strncmp(domain, "mdsp", 4)) 2253 + return MDSP_DOMAIN_ID; 2254 + else if (!strncmp(domain, "sdsp", 4)) 2255 + return SDSP_DOMAIN_ID; 2256 + 2257 + return -EINVAL; 2258 + } 2259 + 2242 2260 static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev) 2243 2261 { 2244 2262 struct device *rdev = &rpdev->dev; ··· 2268 2258 return err; 2269 2259 } 2270 2260 2271 - for (i = 0; i < FASTRPC_DEV_MAX; i++) { 2272 - if (!strcmp(domains[i], domain)) { 2273 - domain_id = i; 2274 - break; 2275 - } 2276 - } 2261 + domain_id = fastrpc_get_domain_id(domain); 2277 2262 2278 2263 if (domain_id < 0) { 2279 - dev_info(rdev, "FastRPC Invalid Domain ID %d\n", domain_id); 2264 + dev_info(rdev, "FastRPC Domain %s not supported\n", domain); 2280 2265 return -EINVAL; 2281 2266 } 2282 2267 ··· 2318 2313 case ADSP_DOMAIN_ID: 2319 2314 case MDSP_DOMAIN_ID: 2320 2315 case SDSP_DOMAIN_ID: 2321 - /* Unsigned PD offloading is only supported on CDSP and CDSP1 */ 2316 + /* Unsigned PD offloading is only supported on CDSP */ 2322 2317 data->unsigned_support = false; 2323 - err = fastrpc_device_register(rdev, data, secure_dsp, domains[domain_id]); 2318 + err = fastrpc_device_register(rdev, data, secure_dsp, domain); 2324 2319 if (err) 2325 2320 goto err_free_data; 2326 2321 break; 2327 2322 case CDSP_DOMAIN_ID: 2328 - case CDSP1_DOMAIN_ID: 2329 2323 data->unsigned_support = true; 2330 2324 /* Create both device nodes so that we can allow both Signed and Unsigned PD */ 2331 - err = fastrpc_device_register(rdev, data, true, domains[domain_id]); 2325 + err = fastrpc_device_register(rdev, data, true, domain); 2332 2326 if (err) 2333 2327 goto err_free_data; 2334 2328 2335 - err = fastrpc_device_register(rdev, data, false, domains[domain_id]); 2329 + err = fastrpc_device_register(rdev, data, false, domain); 2336 2330 if (err) 2337 2331 goto err_deregister_fdev; 2338 2332 break;