[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190304080630.GA4495@jagdpanzerIV>
Date: Mon, 4 Mar 2019 17:06:30 +0900
From: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
To: Calvin Owens <calvinowens@...com>
Cc: Petr Mladek <pmladek@...e.com>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jonathan Corbet <corbet@....net>, linux-kernel@...r.kernel.org,
linux-serial@...r.kernel.org
Subject: Re: [PATCH 4/4] printk: Add a device attribute for the per-console
loglevel
On (03/01/19 16:48), Calvin Owens wrote:
> +static ssize_t loglevel_store(struct device *dev, struct device_attribute *attr,
> + const char *buf, size_t count)
> +{
> + struct console *con = container_of(dev, struct console, dev);
> + ssize_t ret;
> + int tmp;
> +
> + ret = kstrtoint(buf, 10, &tmp);
> + if (ret < 0)
> + return ret;
> +
> + if (tmp < LOGLEVEL_EMERG)
> + return -ERANGE;
> +
> + /*
> + * Mimic the behavior of /dev/kmsg with respect to minimum_loglevel.
> + */
> + if (tmp < minimum_console_loglevel)
> + tmp = minimum_console_loglevel;
> +
> + con->level = tmp;
> + return ret;
> +}
> +
> +static DEVICE_ATTR_RW(loglevel);
> +
> +static struct attribute *console_sysfs_attrs[] = {
> + &dev_attr_loglevel.attr,
> + NULL,
> +};
> +ATTRIBUTE_GROUPS(console_sysfs);
> +
> static struct bus_type console_subsys = {
> .name = "console",
> + .dev_groups = console_sysfs_groups,
> };
Do we really need to change this dynamically? Console options are
traditionally static (boot param or DT). Can we also be happy with
the static per-console loglevel?
-ss
Powered by blists - more mailing lists