Re: [RFC/PATCH] Per-device parameter support (13/16)

From: Rusty Russell
Date: Mon Oct 25 2004 - 00:58:28 EST


On Sat, 2004-10-23 at 13:31 +0900, Tejun Heo wrote:
> dp_13_devparam.diff
>
> This is the 13rd patch of 16 patches for devparam.
>
> This patch adds needed data fields to module and device structures
> and actually implements devparam. This patch doesn't hook devparam
> into the driver model it's done in the next patch.

> +int devparam_unknown_modparam(char *name, char *val, void *arg)
> +{
> + struct module *mod = arg;
> + char **param;
> +
> + param = vector_elem(&mod->param_vec, vector_len(&mod->param_vec),
> + GFP_KERNEL);
> +
> + if (param == NULL) {
> + printk(KERN_ERR
> + "Device params: Insufficient memory for `%s'\n", name);
> + return -ENOMEM;
> + }
> +
> + param[0] = name;
> + param[1] = val;
> +
> + return 0;
> +}
> +
> +void devparam_module_done(struct module *mod)
> +{
> + struct vector *vec = &mod->param_vec;
> + int i;
> +
> + for (i = 0; i < vector_len(vec); i++) {
> + char **param = vector_elem(vec, i, 0);
> + if (param[0])
> + printk(KERN_ERR
> + "Device params: Unknown parameter `%s'\n",
> + param[0]);
> + }
> +
> + vector_destroy(vec);
> +}

That seems a strange place to warn... Is that right?

> +
> + /* Module parameter vector, used by deviceparam */
> + struct vector param_vec;

I don't mind the addition of your vector type, but adding infrastructure
always results in arguments. Can you think of another place which needs
it?

Rusty.
--
A bad analogy is like a leaky screwdriver -- Richard Braakman

-
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/