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>
This commit is contained in:
parent
a0ccd2511b
commit
bf89b0bf30
|
@ -51,6 +51,22 @@ config ATA_VERBOSE_ERROR
|
|||
|
||||
If unsure, say Y.
|
||||
|
||||
config ATA_FORCE
|
||||
bool "\"libata.force=\" kernel parameter support" if EXPERT
|
||||
default y
|
||||
help
|
||||
This option adds support for "libata.force=" kernel parameter for
|
||||
forcing configuration settings.
|
||||
|
||||
For further information, please read
|
||||
<file:Documentation/admin-guide/kernel-parameters.txt>.
|
||||
|
||||
This option will enlarge the kernel by approx. 3KB. Disable it if
|
||||
kernel size is more important than ability to override the default
|
||||
configuration settings.
|
||||
|
||||
If unsure, say Y.
|
||||
|
||||
config ATA_ACPI
|
||||
bool "ATA ACPI Support"
|
||||
depends on ACPI
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -37,7 +37,11 @@ extern int libata_noacpi;
|
|||
extern int libata_allow_tpm;
|
||||
extern const struct device_type ata_port_type;
|
||||
extern struct ata_link *ata_dev_phys_link(struct ata_device *dev);
|
||||
#ifdef CONFIG_ATA_FORCE
|
||||
extern void ata_force_cbl(struct ata_port *ap);
|
||||
#else
|
||||
static inline void ata_force_cbl(struct ata_port *ap) { }
|
||||
#endif
|
||||
extern u64 ata_tf_to_lba(const struct ata_taskfile *tf);
|
||||
extern u64 ata_tf_to_lba48(const struct ata_taskfile *tf);
|
||||
extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev, int tag);
|
||||
|
|
Loading…
Reference in New Issue