Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp2264705imb; Mon, 4 Mar 2019 00:07:17 -0800 (PST) X-Google-Smtp-Source: APXvYqwlXtJjj4kiSNPm0mPKUoQXjAhjQVhJ1EgFsmcQHC3nJt6mco0X/2tK3luvOAZthZF33U1R X-Received: by 2002:a17:902:64:: with SMTP id 91mr19666727pla.229.1551686837055; Mon, 04 Mar 2019 00:07:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551686837; cv=none; d=google.com; s=arc-20160816; b=eMU0KMi1A0dXvgYbZZSvAetn7dEP9zDziLvnsk6mUCUc1xPi/1mcvCtZ8tOxAtAkfE bHo0Zb83HtXcqbW+XWUU6AU/a0vi9Ko1hIJGgmK7gPt344t8q9rW3ELq5vQ9PCmZDeXx 2obaiHmSuJ+X9seEaSqKOSdxASl+TPLmPWlbTqn8YXXPxo9FmPF7HjVBgdxv6ygk1uNF ZcWye3iVfYcNctO3aGu1RaVl1Ls7Qv+qE+VhnwaIq+7ijNqqdM5uh7jv5pTQ8PKJ31nq jSOEZ9Y5N1d2VnzaY7LAMA7K7jwGNdb15H46Z3sEOhB4ggnsZ2ISd07R5A58mdSgbyZ7 GTtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=PK7rdtt5Ad1yU7g4P6dJDoQSxRfS0CWU2bWY21Y4Lcs=; b=RftVRHWGf3Oew6cMUxFwiMX4A2p0L7WIIHe0YScaZAl/zlNIMkTkVODiUZAGWlxMCx L54dlCezpqVUdM/4RNiCjnK/qplnmhGrJXNr1f1u56u5I/6f1CMBAcmNXgaDLqmg2xN+ Hz7on04aBhqoOF3N07qOb2Uu9BG0t9pu1AHcQ7YZGmv+ajnboPX6q7hqFYPIHi8kvEf4 8ooXX12zfjm3a643nZEjAck8t6p+97ufEi0nbMBKuW+NmSBaoA9zZOqwEP0/CzIQutSE kk6vMIv39Zo4atiejIJSTiTrltLqfXf8RlNEOZ+kh1p+B8QNG+JwMroqSVwpHQ8QrlW/ pwmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dR3rbdXm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b2si4913590pls.31.2019.03.04.00.07.01; Mon, 04 Mar 2019 00:07:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dR3rbdXm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726104AbfCDIGf (ORCPT + 99 others); Mon, 4 Mar 2019 03:06:35 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:33826 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726001AbfCDIGf (ORCPT ); Mon, 4 Mar 2019 03:06:35 -0500 Received: by mail-pf1-f196.google.com with SMTP id u9so2437090pfn.1; Mon, 04 Mar 2019 00:06:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=PK7rdtt5Ad1yU7g4P6dJDoQSxRfS0CWU2bWY21Y4Lcs=; b=dR3rbdXmXVsOtmJE/wKJ0v53Cq0idr54x5R2Rw6yyg+Z4v9qCHHyE69FdyQvQN4/Id jrJCC/G2A1LYyiSlVHRwXvZs9hZ+m0GcZIpyBcvSBIBK6oGm8A1J4xt+EqaZexBxyoYg Cjukz/Xkzt+a6YIyue8XM1lxQ1vOo40I47YxAiy0NSw+nNYaoQWSDJouvNN+99fV8q2h ZTvaUe5jDUMFSJQdQwovuk8wpILzas1l3a6OLvGjp3weCT5ubbsjPh4RxVyPZ1mrPWfx JfXMcRGxFJA2EvTOXzTwdYY7OK7Rn1AbJexsPm0RgWIg1r9VY9GN+yDySNKagGL9AWiX GzsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=PK7rdtt5Ad1yU7g4P6dJDoQSxRfS0CWU2bWY21Y4Lcs=; b=C15tk84EMQTRdHQdPV7Xm3oXC/xn1m0onsn/9coKWfRhqNScFBZDgwOFwYmpi7RdyX bBOe7sr8gmujBsc5TlF10bEnjrWoKiSfXvmwXtdfECrLHqYytJzR4sUz3IppsS0dASeR uUrKX0GSLxTpogRek6BaxKQ1vBit7HrO0oCqnKAgHdjmDUlD4YzIOM7N61iVNLA8FSZs +W1UwAPH7nB4bZuK5b5LHR94SpytxB8cO+W6EeCp61kKlP0noGbRTTCCYOJTqp0R6fV+ LsDPilJwUdTnDacNtFz04QK3cLjUeasvQ/czOj0GqiLWIHoCup58vy0LQOghAAlm5PQG lX4A== X-Gm-Message-State: APjAAAW+cjSXZ8CX9LdUTA6Aj/mA2hqq6CUHLyeKTPndb9nP6gLqNCM0 I9IZI7i5nrioRDageCoYeF8= X-Received: by 2002:a17:902:e512:: with SMTP id ck18mr18869097plb.46.1551686794503; Mon, 04 Mar 2019 00:06:34 -0800 (PST) Received: from localhost ([175.223.38.45]) by smtp.gmail.com with ESMTPSA id p5sm7291898pfn.154.2019.03.04.00.06.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Mar 2019 00:06:33 -0800 (PST) Date: Mon, 4 Mar 2019 17:06:30 +0900 From: Sergey Senozhatsky To: Calvin Owens Cc: Petr Mladek , Sergey Senozhatsky , Steven Rostedt , Greg Kroah-Hartman , Jonathan Corbet , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: Re: [PATCH 4/4] printk: Add a device attribute for the per-console loglevel Message-ID: <20190304080630.GA4495@jagdpanzerIV> References: <4f71564063a07837e3c4df41326bad25e7dc4db4.1551486733.git.calvinowens@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4f71564063a07837e3c4df41326bad25e7dc4db4.1551486733.git.calvinowens@fb.com> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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