Re: [PATCH] tpm: Add force device probe option

From: Andrew Morton
Date: Wed Jul 12 2006 - 21:42:20 EST


On Wed, 12 Jul 2006 14:04:33 -0700
Kylene Jo Hall <kjhall@xxxxxxxxxx> wrote:

> Some machine manufacturers are not sticking to the TCG specifications
> and including an ACPI DSDT entry for the TPM which allows PNP discovery
> of the device.

Well that sucks.

> This patch adds a force option that will allow users to
> load the driver if they know there machine has a chip but it is not
> being discovered by the normal processes.
>

>
> +static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
> + const struct pnp_device_id *pnp_id)
> +{
> + unsigned long start, len;
> + start = pnp_mem_start(pnp_dev, 0);
> + len = pnp_mem_len(pnp_dev, 0);

All these starts, ends and lens are now wrong - they should be changed to
resource_size_t. But there's no rush on that - please add it to the todo
list.

> +static int force = 0;

The `= 0' here is unneeded. It's also undesirable, since it adds to the size
of vmlinux on-disk.

> +module_param(force, bool, 0444);
> +MODULE_PARM_DESC(force, "Force device probe rather than using ACPI entry");
> static int __init init_tis(void)
> {
> + int rc;
> +
> + if (force) {
> + driver_register(&tis_drv);

driver_register() can fail and the driver should check for and handle the
failure.

This mistake happens literally thousands of times and we're trying to fix
it up at present. An updated patch would be appreciated, please.

> - pnp_unregister_driver(&tis_pnp_driver);
> + if (force) {
> + platform_device_unregister(pdev);
> + driver_unregister(&tis_drv);
> + }
> + else

} else


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/