Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4553847ybv; Tue, 25 Feb 2020 22:41:21 -0800 (PST) X-Google-Smtp-Source: APXvYqxn5cVQXxHZ2vgvP/xHM+kfKg3u3BYhEyRVW5z0jSxTGRwSutFA1e7vnDXP7DXkI9FlU7Al X-Received: by 2002:a05:6830:1353:: with SMTP id r19mr1832186otq.288.1582699280840; Tue, 25 Feb 2020 22:41:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582699280; cv=none; d=google.com; s=arc-20160816; b=ixiWTw5FbXT4yCih4sC0HITDWuSRunSSBVCJ5EIVDtanoG6sbXNjxSjS3O7Sdxqr4U hnV1p4CpdyklLrzQYhKFbMyeSIm/QCV47EIjKDJk2QyVvGpq+Dz/ACPXVEcesY5ovDhH Ccl7ScD4QcGHAxrYHlxKATWfgexnEtoQd+DpqPHNhBo3rkPXY4HahwRukc93HW//07NR 4Ip4qVZmPqy8r09qu9LmuQTtE426kSKNPiSJ/2sVa8aLYsSeGYUCQPn+8L6ViAcEUdUS CJz5kQPDP2MupcyzaA0raNpVwi2fT8m2LYMhJG3k1XU9xaIFdhmXoyTzB72fzxiWyHO+ uQtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:message-id :in-reply-to:subject:cc:to:from:date; bh=+HW1s6UUHcRLr+x4wFli/Rp3rYfbqmKTQ/WnXeP3dQM=; b=Rwlr0KoM05ruNfxSiqBmSr8bpCxi7CC+J5voeKo7ycbRMk09ceEI4f06HCrduteNwm k7fqhgJ7Fy34oqPd+FBKnBgtwMSleRdvp6XVlnYMfEZ/CIU2sd6DUW5VDhzTZwaY+6/t 7og63gWORPi6gZqNWLz8eRaH/FSU1GvDekfcJy0wfITkFfoCfpBGrKF2nzKcU4xmQ+6L Qld2epYUShTTqDNwq5dBZajiNeFH6FanXhWsKyKU2sB6laLPsin0BUZYjol/3pNRZh7x geyC6CdUS/fdfDfI8DwdbFoqJmWgE/5T0tPjk3gNn4iCsmirEfeDKpo2Ys4Hcv7uzCl3 FoeA== 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 y71si672146oia.82.2020.02.25.22.41.08; Tue, 25 Feb 2020 22:41:20 -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; 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 S1726474AbgBZGkB (ORCPT + 99 others); Wed, 26 Feb 2020 01:40:01 -0500 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:35272 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726089AbgBZGkB (ORCPT ); Wed, 26 Feb 2020 01:40:01 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by kvm5.telegraphics.com.au (Postfix) with ESMTP id E158C29E93; Wed, 26 Feb 2020 01:39:55 -0500 (EST) Date: Wed, 26 Feb 2020 17:39:57 +1100 (AEDT) From: Finn Thain To: Greg Ungerer cc: afzal mohammed , linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org, Thomas Gleixner , Geert Uytterhoeven Subject: Re: [PATCH v2 06/18] m68k: Replace setup_irq() by request_irq() In-Reply-To: Message-ID: References: <00b0bf964278dd0bb3e093283994399ff796cca5.1582471508.git.afzal.mohd.ma@gmail.com> <73c3ad08-963d-fea2-91d7-b06e4ef8d3ef@linux-m68k.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 26 Feb 2020, Greg Ungerer wrote: > > That error would almost always be -EBUSY, right? > > I expect it will never fail this early in boot. If so, it suggests to me that tweaking the error message string is just bikeshedding and that adding these error messages across the tree is just bloat. > But how will you know if it really is EBUSY if you don't print it out? > > > Moreover, compare this change, > > > > - setup_irq(TMR_IRQ_NUM, &m68328_timer_irq); > > + request_irq(TMR_IRQ_NUM, hw_tick, IRQF_TIMER, "timer", NULL); > > > > with this change, > > > > + int err; > > > > - setup_irq(TMR_IRQ_NUM, &m68328_timer_irq); > > + err = request_irq(TMR_IRQ_NUM, hw_tick, IRQF_TIMER, "timer", NULL); > > + if (err) > > + return err; > > > > Isn't the latter change the more common pattern? It prints nothing. > > Hmm, in my experience the much more common pattern is: > > > + int err; > > > > - setup_irq(TMR_IRQ_NUM, &m68328_timer_irq); > > + err = request_irq(TMR_IRQ_NUM, hw_tick, IRQF_TIMER, "timer", NULL); > > + if (err) { > > + pr_err("timer: request_irq() failed with err=%d\n", err); > > + return err; > > + } > > Where the pr_err() could be one of pr_err, printk, dev_err, ... > A rough poll using 'git grep' seems to agree with your assessment. If -EBUSY means the end user has misconfigured something, printing "request_irq failed" would be helpful. But does that still happen? Printing any error message for -ENOMEM is frowned upon, and printing -12 is really unhelpful. So the most popular pattern isn't that great, though it is usually less verbose than the example you've given. Besides, introducing local variables and altering control flow seems well out-of-scope for this kind of refactoring, right? Anyway, if you're going to add an error message, pr_err("%s: request_irq failed", foo) is unavoidable whenever foo isn't a string constant, so one can't expect to grep the source code for the literal error message from the log. BTW, one of the benefits of "%s: request_irq failed" is that a compilation unit with multiple request_irq calls permits the compiler to coalesce all duplicated format strings. Whereas, that's not possible with "foo: request_irq failed" and "bar: request_irq failed".