diff options
author | Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> | 2020-03-26 18:58:22 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2020-03-26 19:28:20 +0300 |
commit | bf89b0bf3038cdc972b563b16c68cee1b8eefb31 (patch) | |
tree | be86a8998acf9ec4eb3f982acb07f8087a0581bb /drivers/ata/libata-core.c | |
parent | a0ccd2511b6f70394b30f8290da8bfc723d6bc07 (diff) | |
download | linux-bf89b0bf3038cdc972b563b16c68cee1b8eefb31.tar.xz |
ata: make "libata.force" kernel parameter optional
Add ATA_FORCE config option (visible only if EXPERT config
option is enabled) and make "libata.force" kernel parameter
optional.
Code size savings on m68k arch using (modified) atari_defconfig:
text data bss dec hex filename
w/ CONFIG_ATA_FORCE=y:
31983 572 40 32595 7f53 drivers/ata/libata-core.o
w/ CONFIG_ATA_FROCE=n:
28958 316 32 29306 727a drivers/ata/libata-core.o
Suggested-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/ata/libata-core.c')
-rw-r--r-- | drivers/ata/libata-core.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 20c22dbc1f24..beca5f91bb4c 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -89,6 +89,7 @@ static unsigned long ata_dev_blacklisted(const struct ata_device *dev); atomic_t ata_print_id = ATOMIC_INIT(0); +#ifdef CONFIG_ATA_FORCE struct ata_force_param { const char *name; u8 cbl; @@ -112,6 +113,7 @@ static char ata_force_param_buf[COMMAND_LINE_SIZE] __initdata; /* param_buf is thrown away after initialization, disallow read */ module_param_string(force, ata_force_param_buf, sizeof(ata_force_param_buf), 0); MODULE_PARM_DESC(force, "Force ATA configurations including cable type, link speed and transfer mode (see Documentation/admin-guide/kernel-parameters.rst for details)"); +#endif static int atapi_enabled = 1; module_param(atapi_enabled, int, 0444); @@ -303,6 +305,7 @@ struct ata_link *ata_dev_phys_link(struct ata_device *dev) return ap->slave_link; } +#ifdef CONFIG_ATA_FORCE /** * ata_force_cbl - force cable type according to libata.force * @ap: ATA port of interest @@ -483,6 +486,11 @@ static void ata_force_horkage(struct ata_device *dev) fe->param.name); } } +#else +static inline void ata_force_link_limits(struct ata_link *link) { } +static inline void ata_force_xfermask(struct ata_device *dev) { } +static inline void ata_force_horkage(struct ata_device *dev) { } +#endif /** * atapi_cmd_type - Determine ATAPI command type from SCSI opcode @@ -6080,6 +6088,7 @@ int ata_platform_remove_one(struct platform_device *pdev) } EXPORT_SYMBOL_GPL(ata_platform_remove_one); +#ifdef CONFIG_ATA_FORCE static int __init ata_parse_force_one(char **cur, struct ata_force_ent *force_ent, const char **reason) @@ -6259,6 +6268,15 @@ static void __init ata_parse_force_param(void) ata_force_tbl_size = idx; } +static void ata_free_force_param(void) +{ + kfree(ata_force_tbl); +} +#else +static inline void ata_parse_force_param(void) { } +static inline void ata_free_force_param(void) { } +#endif + static int __init ata_init(void) { int rc; @@ -6267,7 +6285,7 @@ static int __init ata_init(void) rc = ata_sff_init(); if (rc) { - kfree(ata_force_tbl); + ata_free_force_param(); return rc; } @@ -6291,7 +6309,7 @@ static void __exit ata_exit(void) ata_release_transport(ata_scsi_transport_template); libata_transport_exit(); ata_sff_exit(); - kfree(ata_force_tbl); + ata_free_force_param(); } subsys_initcall(ata_init); |