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.

bus: fsl-mc: constify the struct device_type usage

Since commit aed65af1cc2f ("drivers: make device_type const"), the driver
core can properly handle constant struct device_type. Move all the
device_type variables used in the bus to be constant structures as well,
placing it into read-only memory which can not be modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo.marliere@suse.com>
Link: https://lore.kernel.org/r/20240904-class_cleanup-fsl-mc-bus-v2-1-83fa25cbdc68@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Ricardo B. Marliere and committed by
Greg Kroah-Hartman
896be785 bf2aa7df

+33 -33
+18 -18
drivers/bus/fsl-mc/fsl-mc-bus.c
··· 320 320 }; 321 321 EXPORT_SYMBOL_GPL(fsl_mc_bus_type); 322 322 323 - struct device_type fsl_mc_bus_dprc_type = { 323 + const struct device_type fsl_mc_bus_dprc_type = { 324 324 .name = "fsl_mc_bus_dprc" 325 325 }; 326 326 EXPORT_SYMBOL_GPL(fsl_mc_bus_dprc_type); 327 327 328 - struct device_type fsl_mc_bus_dpni_type = { 328 + const struct device_type fsl_mc_bus_dpni_type = { 329 329 .name = "fsl_mc_bus_dpni" 330 330 }; 331 331 EXPORT_SYMBOL_GPL(fsl_mc_bus_dpni_type); 332 332 333 - struct device_type fsl_mc_bus_dpio_type = { 333 + const struct device_type fsl_mc_bus_dpio_type = { 334 334 .name = "fsl_mc_bus_dpio" 335 335 }; 336 336 EXPORT_SYMBOL_GPL(fsl_mc_bus_dpio_type); 337 337 338 - struct device_type fsl_mc_bus_dpsw_type = { 338 + const struct device_type fsl_mc_bus_dpsw_type = { 339 339 .name = "fsl_mc_bus_dpsw" 340 340 }; 341 341 EXPORT_SYMBOL_GPL(fsl_mc_bus_dpsw_type); 342 342 343 - struct device_type fsl_mc_bus_dpbp_type = { 343 + const struct device_type fsl_mc_bus_dpbp_type = { 344 344 .name = "fsl_mc_bus_dpbp" 345 345 }; 346 346 EXPORT_SYMBOL_GPL(fsl_mc_bus_dpbp_type); 347 347 348 - struct device_type fsl_mc_bus_dpcon_type = { 348 + const struct device_type fsl_mc_bus_dpcon_type = { 349 349 .name = "fsl_mc_bus_dpcon" 350 350 }; 351 351 EXPORT_SYMBOL_GPL(fsl_mc_bus_dpcon_type); 352 352 353 - struct device_type fsl_mc_bus_dpmcp_type = { 353 + const struct device_type fsl_mc_bus_dpmcp_type = { 354 354 .name = "fsl_mc_bus_dpmcp" 355 355 }; 356 356 EXPORT_SYMBOL_GPL(fsl_mc_bus_dpmcp_type); 357 357 358 - struct device_type fsl_mc_bus_dpmac_type = { 358 + const struct device_type fsl_mc_bus_dpmac_type = { 359 359 .name = "fsl_mc_bus_dpmac" 360 360 }; 361 361 EXPORT_SYMBOL_GPL(fsl_mc_bus_dpmac_type); 362 362 363 - struct device_type fsl_mc_bus_dprtc_type = { 363 + const struct device_type fsl_mc_bus_dprtc_type = { 364 364 .name = "fsl_mc_bus_dprtc" 365 365 }; 366 366 EXPORT_SYMBOL_GPL(fsl_mc_bus_dprtc_type); 367 367 368 - struct device_type fsl_mc_bus_dpseci_type = { 368 + const struct device_type fsl_mc_bus_dpseci_type = { 369 369 .name = "fsl_mc_bus_dpseci" 370 370 }; 371 371 EXPORT_SYMBOL_GPL(fsl_mc_bus_dpseci_type); 372 372 373 - struct device_type fsl_mc_bus_dpdmux_type = { 373 + const struct device_type fsl_mc_bus_dpdmux_type = { 374 374 .name = "fsl_mc_bus_dpdmux" 375 375 }; 376 376 EXPORT_SYMBOL_GPL(fsl_mc_bus_dpdmux_type); 377 377 378 - struct device_type fsl_mc_bus_dpdcei_type = { 378 + const struct device_type fsl_mc_bus_dpdcei_type = { 379 379 .name = "fsl_mc_bus_dpdcei" 380 380 }; 381 381 EXPORT_SYMBOL_GPL(fsl_mc_bus_dpdcei_type); 382 382 383 - struct device_type fsl_mc_bus_dpaiop_type = { 383 + const struct device_type fsl_mc_bus_dpaiop_type = { 384 384 .name = "fsl_mc_bus_dpaiop" 385 385 }; 386 386 EXPORT_SYMBOL_GPL(fsl_mc_bus_dpaiop_type); 387 387 388 - struct device_type fsl_mc_bus_dpci_type = { 388 + const struct device_type fsl_mc_bus_dpci_type = { 389 389 .name = "fsl_mc_bus_dpci" 390 390 }; 391 391 EXPORT_SYMBOL_GPL(fsl_mc_bus_dpci_type); 392 392 393 - struct device_type fsl_mc_bus_dpdmai_type = { 393 + const struct device_type fsl_mc_bus_dpdmai_type = { 394 394 .name = "fsl_mc_bus_dpdmai" 395 395 }; 396 396 EXPORT_SYMBOL_GPL(fsl_mc_bus_dpdmai_type); 397 397 398 - struct device_type fsl_mc_bus_dpdbg_type = { 398 + const struct device_type fsl_mc_bus_dpdbg_type = { 399 399 .name = "fsl_mc_bus_dpdbg" 400 400 }; 401 401 EXPORT_SYMBOL_GPL(fsl_mc_bus_dpdbg_type); 402 402 403 - static struct device_type *fsl_mc_get_device_type(const char *type) 403 + static const struct device_type *fsl_mc_get_device_type(const char *type) 404 404 { 405 405 static const struct { 406 - struct device_type *dev_type; 406 + const struct device_type *dev_type; 407 407 const char *type; 408 408 } dev_types[] = { 409 409 { &fsl_mc_bus_dprc_type, "dprc" },
+15 -15
include/linux/fsl/mc.h
··· 438 438 439 439 extern const struct bus_type fsl_mc_bus_type; 440 440 441 - extern struct device_type fsl_mc_bus_dprc_type; 442 - extern struct device_type fsl_mc_bus_dpni_type; 443 - extern struct device_type fsl_mc_bus_dpio_type; 444 - extern struct device_type fsl_mc_bus_dpsw_type; 445 - extern struct device_type fsl_mc_bus_dpbp_type; 446 - extern struct device_type fsl_mc_bus_dpcon_type; 447 - extern struct device_type fsl_mc_bus_dpmcp_type; 448 - extern struct device_type fsl_mc_bus_dpmac_type; 449 - extern struct device_type fsl_mc_bus_dprtc_type; 450 - extern struct device_type fsl_mc_bus_dpseci_type; 451 - extern struct device_type fsl_mc_bus_dpdmux_type; 452 - extern struct device_type fsl_mc_bus_dpdcei_type; 453 - extern struct device_type fsl_mc_bus_dpaiop_type; 454 - extern struct device_type fsl_mc_bus_dpci_type; 455 - extern struct device_type fsl_mc_bus_dpdmai_type; 441 + extern const struct device_type fsl_mc_bus_dprc_type; 442 + extern const struct device_type fsl_mc_bus_dpni_type; 443 + extern const struct device_type fsl_mc_bus_dpio_type; 444 + extern const struct device_type fsl_mc_bus_dpsw_type; 445 + extern const struct device_type fsl_mc_bus_dpbp_type; 446 + extern const struct device_type fsl_mc_bus_dpcon_type; 447 + extern const struct device_type fsl_mc_bus_dpmcp_type; 448 + extern const struct device_type fsl_mc_bus_dpmac_type; 449 + extern const struct device_type fsl_mc_bus_dprtc_type; 450 + extern const struct device_type fsl_mc_bus_dpseci_type; 451 + extern const struct device_type fsl_mc_bus_dpdmux_type; 452 + extern const struct device_type fsl_mc_bus_dpdcei_type; 453 + extern const struct device_type fsl_mc_bus_dpaiop_type; 454 + extern const struct device_type fsl_mc_bus_dpci_type; 455 + extern const struct device_type fsl_mc_bus_dpdmai_type; 456 456 457 457 static inline bool is_fsl_mc_bus_dprc(const struct fsl_mc_device *mc_dev) 458 458 {