Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5501357ybe; Tue, 17 Sep 2019 08:56:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqyp7IT9b8MBI+Xpw9R/rkNq9UmAA/cG0YpJ5siaVwDsI6Nhc20NxRuEieHO3XeKB0pWpNwd X-Received: by 2002:a05:6402:a4b:: with SMTP id bt11mr3190555edb.175.1568735760525; Tue, 17 Sep 2019 08:56:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568735760; cv=none; d=google.com; s=arc-20160816; b=OndQmBvpRs6j2CshcWvW5aEju0bvEI0W8YG8kpJzm0y7LoPrC/QUHVIRipOO3DrG7I Wi1nJoJLwLEzt+Rq+Rx7LiWl8KXz/VqRnISXYAFZLjU5jA4HRZSrHdYUItUMhVNsmHCp sj3XCgviZs1XH4ISdA9+XuALJVhFZUwQHN7cGkR3pJeazaekhDhtkIup0GMB+pS+ZXPj iS99lYdjeSPHQEYab/YOyn1eDzUJnj/BscvbkNMx1+Tez/dpf2lbCHQmuZgof+2y4FDx l7xvZWc9yW+Zx4KCJyKg/BO/yG97JfJ1Nh3FFcBAlRijVuNWqccJBU2ED2A1BTubmJjk IjBQ== 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; bh=GQ1BfZmM2Ql3Ggcg7pBmM2ID6VsZwb+kU1EK/QWVB54=; b=gHdSPSrWF6+u963kglR9Vm++r+CQ3yY/M6NCYCr7EIjo9EmA6GEWTT3lxC/sqCRnhw j+bncpPpwaDVddvVLKlQ5pjdCp6R1PxocDwf2eQJm6gOaZUr8vTl/ANaPJQFfvubW0j4 5gc1roKndvW60brXwc3wD1t52VE1Xwqbk4nFakeqYdIWYGp8nnFj+bdmXJQbmufpQDTk w4FoP5qLXb6jWIVww68DbDFBY61kKRkzyXii2XJnpq31BheGuvgujaNi0bgU2R4VK9rA takEDb41VQQREUjZD6FAIH+aNsTYW3HoQLE2JcTsTUOh0sQIkW9x0ZBUrIDc2zl1WaH/ 1nDA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n16si1370252ejh.165.2019.09.17.08.55.36; Tue, 17 Sep 2019 08:56:00 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404538AbfIQHwV (ORCPT + 99 others); Tue, 17 Sep 2019 03:52:21 -0400 Received: from mx2.suse.de ([195.135.220.15]:36584 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727479AbfIQHwV (ORCPT ); Tue, 17 Sep 2019 03:52:21 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 8B8BAB048; Tue, 17 Sep 2019 07:52:18 +0000 (UTC) Date: Tue, 17 Sep 2019 09:52:16 +0200 From: Petr Mladek To: Steven Rostedt Cc: Daniel Vetter , AndreaParri , Sergey Senozhatsky , Sergey Senozhatsky , Brendan Higgins , Paul Turner , Tetsuo Handa , Peter Zijlstra , John Ogness , Thomas Gleixner , LinusTorvalds , Greg Kroah-Hartman , Theodore Ts'o , PraritBhargava , LKML Subject: Re: printk meeting at LPC Message-ID: <20190917075216.agzoy6cnol5eio6y@pathway.suse.cz> References: <20190904123531.GA2369@hirez.programming.kicks-ass.net> <20190905130513.4fru6yvjx73pjx7p@pathway.suse.cz> <20190905143118.GP2349@hirez.programming.kicks-ass.net> <20190905121101.60c78422@oasis.local.home> <87k1acz5rx.fsf@linutronix.de> <20190916104624.n3jh363z37ah2kxa@pathway.suse.cz> <20190916094314.6053f988@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190916094314.6053f988@gandalf.local.home> User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 2019-09-16 09:43:14, Steven Rostedt wrote: > On Mon, 16 Sep 2019 12:46:24 +0200 > Petr Mladek wrote: > > > By the way, do we need to keep printk() return bytes like printf() ? > > > Maybe we can make printk() return "void", for almost nobody can do > > > meaningful things with the return value. > > > > It is true that I have never seen anyone checking the return value. > > On the other hand, it is a minor detail. And I would prefer to stay > > compatible with the userland printf() as much as possible. > > I understand your wanting to keep compatibility with printf(), but I > would suggest that we only do so if it doesn't complicate any of the > design. I'm actually leaning on recommending that we remove the return > value, to prevent there becoming a dependency on it. I don't see any > reason to have the "number of bytes processed" as the return value > being useful within the kernel. Heh, I did some grepping and the return value is actually used on three locations: $> git grep "= printk(" drivers/scsi/aic7xxx/aic79xx_core.c: printed = printk("%s[0x%x]", name, value); drivers/scsi/aic7xxx/aic79xx_core.c: printed += printk(" "); drivers/scsi/aic7xxx/aic79xx_core.c: printed += printk("%s%s", drivers/scsi/aic7xxx/aic79xx_core.c: printed += printk(") "); drivers/scsi/aic7xxx/aic79xx_core.c: printed += printk(" "); drivers/scsi/aic7xxx/aic79xx_core.c: cur_col = printk("\n%3d FIFO_USE[0x%x] ", SCB_GET_TAG(scb), drivers/scsi/aic7xxx/aic79xx_core.c: cur_col += printk("SHADDR = 0x%x%x, SHCNT = 0x%x ", drivers/scsi/aic7xxx/aic79xx_core.c: cur_col += printk("HADDR = 0x%x%x, HCNT = 0x%x ", drivers/scsi/aic7xxx/aic7xxx_core.c: printed = printk("%s[0x%x]", name, value); drivers/scsi/aic7xxx/aic7xxx_core.c: printed += printk(" "); drivers/scsi/aic7xxx/aic7xxx_core.c: printed += printk("%s%s", drivers/scsi/aic7xxx/aic7xxx_core.c: printed += printk(") "); drivers/scsi/aic7xxx/aic7xxx_core.c: printed += printk(" "); drivers/scsi/aic7xxx/aic7xxx_core.c: cur_col = printk("\n%3d ", i); drivers/scsi/aic7xxx/aic7xxx_core.c: cur_col = printk("\n%3d ", scb->hscb->tag); drivers/scsi/libsas/sas_ata.c: r = printk("%s" SAS_FMT "ata%u: %s: %pV", kernel/locking/lockdep.c: len += printk("%*s %s", depth, "", usage_str[bit]); kernel/locking/lockdep.c: len += printk(KERN_CONT " at:\n"); It is probably not a big deal. For example, lockdep uses the value just for formatting (extra spaces) when printing backtrace. I agree that it does not make sense to return the value if it complicates the code too much. Well, we will need to count the string length also from another reason (reservation). Best Regards, Petr