Skip to content

Commit 896be78

Browse files
rbmarlieregregkh
authored andcommitted
bus: fsl-mc: constify the struct device_type usage
Since commit aed65af ("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>
1 parent bf2aa7d commit 896be78

File tree

2 files changed

+33
-33
lines changed

2 files changed

+33
-33
lines changed

drivers/bus/fsl-mc/fsl-mc-bus.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -320,90 +320,90 @@ const struct bus_type fsl_mc_bus_type = {
320320
};
321321
EXPORT_SYMBOL_GPL(fsl_mc_bus_type);
322322

323-
struct device_type fsl_mc_bus_dprc_type = {
323+
const struct device_type fsl_mc_bus_dprc_type = {
324324
.name = "fsl_mc_bus_dprc"
325325
};
326326
EXPORT_SYMBOL_GPL(fsl_mc_bus_dprc_type);
327327

328-
struct device_type fsl_mc_bus_dpni_type = {
328+
const struct device_type fsl_mc_bus_dpni_type = {
329329
.name = "fsl_mc_bus_dpni"
330330
};
331331
EXPORT_SYMBOL_GPL(fsl_mc_bus_dpni_type);
332332

333-
struct device_type fsl_mc_bus_dpio_type = {
333+
const struct device_type fsl_mc_bus_dpio_type = {
334334
.name = "fsl_mc_bus_dpio"
335335
};
336336
EXPORT_SYMBOL_GPL(fsl_mc_bus_dpio_type);
337337

338-
struct device_type fsl_mc_bus_dpsw_type = {
338+
const struct device_type fsl_mc_bus_dpsw_type = {
339339
.name = "fsl_mc_bus_dpsw"
340340
};
341341
EXPORT_SYMBOL_GPL(fsl_mc_bus_dpsw_type);
342342

343-
struct device_type fsl_mc_bus_dpbp_type = {
343+
const struct device_type fsl_mc_bus_dpbp_type = {
344344
.name = "fsl_mc_bus_dpbp"
345345
};
346346
EXPORT_SYMBOL_GPL(fsl_mc_bus_dpbp_type);
347347

348-
struct device_type fsl_mc_bus_dpcon_type = {
348+
const struct device_type fsl_mc_bus_dpcon_type = {
349349
.name = "fsl_mc_bus_dpcon"
350350
};
351351
EXPORT_SYMBOL_GPL(fsl_mc_bus_dpcon_type);
352352

353-
struct device_type fsl_mc_bus_dpmcp_type = {
353+
const struct device_type fsl_mc_bus_dpmcp_type = {
354354
.name = "fsl_mc_bus_dpmcp"
355355
};
356356
EXPORT_SYMBOL_GPL(fsl_mc_bus_dpmcp_type);
357357

358-
struct device_type fsl_mc_bus_dpmac_type = {
358+
const struct device_type fsl_mc_bus_dpmac_type = {
359359
.name = "fsl_mc_bus_dpmac"
360360
};
361361
EXPORT_SYMBOL_GPL(fsl_mc_bus_dpmac_type);
362362

363-
struct device_type fsl_mc_bus_dprtc_type = {
363+
const struct device_type fsl_mc_bus_dprtc_type = {
364364
.name = "fsl_mc_bus_dprtc"
365365
};
366366
EXPORT_SYMBOL_GPL(fsl_mc_bus_dprtc_type);
367367

368-
struct device_type fsl_mc_bus_dpseci_type = {
368+
const struct device_type fsl_mc_bus_dpseci_type = {
369369
.name = "fsl_mc_bus_dpseci"
370370
};
371371
EXPORT_SYMBOL_GPL(fsl_mc_bus_dpseci_type);
372372

373-
struct device_type fsl_mc_bus_dpdmux_type = {
373+
const struct device_type fsl_mc_bus_dpdmux_type = {
374374
.name = "fsl_mc_bus_dpdmux"
375375
};
376376
EXPORT_SYMBOL_GPL(fsl_mc_bus_dpdmux_type);
377377

378-
struct device_type fsl_mc_bus_dpdcei_type = {
378+
const struct device_type fsl_mc_bus_dpdcei_type = {
379379
.name = "fsl_mc_bus_dpdcei"
380380
};
381381
EXPORT_SYMBOL_GPL(fsl_mc_bus_dpdcei_type);
382382

383-
struct device_type fsl_mc_bus_dpaiop_type = {
383+
const struct device_type fsl_mc_bus_dpaiop_type = {
384384
.name = "fsl_mc_bus_dpaiop"
385385
};
386386
EXPORT_SYMBOL_GPL(fsl_mc_bus_dpaiop_type);
387387

388-
struct device_type fsl_mc_bus_dpci_type = {
388+
const struct device_type fsl_mc_bus_dpci_type = {
389389
.name = "fsl_mc_bus_dpci"
390390
};
391391
EXPORT_SYMBOL_GPL(fsl_mc_bus_dpci_type);
392392

393-
struct device_type fsl_mc_bus_dpdmai_type = {
393+
const struct device_type fsl_mc_bus_dpdmai_type = {
394394
.name = "fsl_mc_bus_dpdmai"
395395
};
396396
EXPORT_SYMBOL_GPL(fsl_mc_bus_dpdmai_type);
397397

398-
struct device_type fsl_mc_bus_dpdbg_type = {
398+
const struct device_type fsl_mc_bus_dpdbg_type = {
399399
.name = "fsl_mc_bus_dpdbg"
400400
};
401401
EXPORT_SYMBOL_GPL(fsl_mc_bus_dpdbg_type);
402402

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)
404404
{
405405
static const struct {
406-
struct device_type *dev_type;
406+
const struct device_type *dev_type;
407407
const char *type;
408408
} dev_types[] = {
409409
{ &fsl_mc_bus_dprc_type, "dprc" },

include/linux/fsl/mc.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -438,21 +438,21 @@ struct fsl_mc_device *fsl_mc_get_endpoint(struct fsl_mc_device *mc_dev,
438438

439439
extern const struct bus_type fsl_mc_bus_type;
440440

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;
456456

457457
static inline bool is_fsl_mc_bus_dprc(const struct fsl_mc_device *mc_dev)
458458
{

0 commit comments

Comments
 (0)