Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3797758pxa; Sun, 9 Aug 2020 12:02:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLrkEFZ3Vxv9HBC6KbOG+D1do8xkemC2s6x2SYS3Me9wKo/n6dMzrEf3zrJJlvseVdJJn7 X-Received: by 2002:a17:906:84cf:: with SMTP id f15mr19404714ejy.259.1596999754861; Sun, 09 Aug 2020 12:02:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596999754; cv=none; d=google.com; s=arc-20160816; b=q9fSEcBVbqwrcbZTi9fzQuWQEiEBJGaC2ZDMy4gKdajtuG/sgo8n0JnvNL7DdbfSaJ 4AwnacKCQ71kuulaRMAyFzMZ3oVGt9fQwxQqQC4ohH42iPNyrEdQtrARaseulNT2/Y2t ZPJ+A9yu7a8f1/SSE0VVtxrPe6CzSx4rqonuDn/UfjFvP8lZJQ7403+AHtcDLYCN0Vh8 TlXq0Ii0zsaaU6TLzSiXRWRv8AndFMeplEdlvIQL+r0hh/fwItGllOsNDJoJnjmmPNKY kYZS3lwyh5qt1+o8c3IAj4YUzw9Zxy627TFTVwtQGNMo07JCoi5tuHP2LvFHVe0y/TYT PQwA== 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=dCQmffw/i58ICs4V65P0Gmx0jlfMHsHEylHgWzK3pBQ=; b=NR1jap66gOl+8SLunhWswfluYgrRbGfSWz4iEtMb7AdnKb4thdJHO6pBlZ4ZWI3KGg Y4IwEhlhjRUsizUgfNv/+9qWhQ2+vZmZh8Ta+3MeapVfRu+b7VHOmGbCgLhBDWH6Du9V LEjQhs0l68PoYudcBLpG9yhUos3h1RiKrpNpRmv7D+r6dpIqL+XMUjxePoo7pjebKmu3 MbiNSP9D/6q27gZWNVdw4gJEeZGPXjTDklvUrhCJx6Fba16YvOz0uu4shDfTg76wBMoN 94EUQlTc44ArWy6GnMe0WykvrlK8lpwWNauKhabe2fXZyTcURlUGH8iamocn0JN5JSx7 +nPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=fhcvqaTm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d6si9696832ejp.151.2020.08.09.12.02.10; Sun, 09 Aug 2020 12:02:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=fhcvqaTm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726460AbgHITBm (ORCPT + 99 others); Sun, 9 Aug 2020 15:01:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726321AbgHITBl (ORCPT ); Sun, 9 Aug 2020 15:01:41 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43926C061756 for ; Sun, 9 Aug 2020 12:01:41 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id g33so3696566pgb.4 for ; Sun, 09 Aug 2020 12:01:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=dCQmffw/i58ICs4V65P0Gmx0jlfMHsHEylHgWzK3pBQ=; b=fhcvqaTmn2sVgbdLQ8Q30+/nra5OheM++NBD41UQhMjeydwWokLZcZWkFU2vqd8lhd 7z/r0bbwCRJFT1+SjKEfbF9/4pVo6toRdfx+D4Wds03ZIpZwwukif2ngVWtJpZWLFnuM zT1qKc8xQ2QpIc352ypogFc2e6VOU1kBZd5fjbfrg8M8p5+xdvNl/j9xY9PM48Exg1M1 HZTgSpJd7asX5fx1T4fLbZrPWrwBerGIlq7stIsnW5fuXEfz6V5AeA37LVzJBXmtYKq7 M8OOXTKrjmCMjA1/sXDXRbCP+mSf7iZUf/2gYUQ4UhPmyFbWqkLrDNcOhfnpg7BzAA+8 PZAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=dCQmffw/i58ICs4V65P0Gmx0jlfMHsHEylHgWzK3pBQ=; b=pHW5iRTDusnK4ZdmNl0HCsOjsx7D1cu5nDNjM67YiVyae+24l6pu1IteivzlhPYqX4 zmIaMNoB9o5gvSTzixCBORFkDUAi/fHw10kLq8NxEpxImezoyYNAcyhK3cWC9LeszrOI IfQ7wQ85i6sWZ90FT6l85ejWgV6If6LFZFWluFn0Ysh0sNsVnGweWOXpdjlls+XbYVe3 GI0IsnOXhjtaEqQ5EZ2doRvhWCFA9rEiTDzLF9jMcF2esmhfd3vUol0mINQWhBHpZr8f VphA44m+uUry7371q5f4KI8am5qBNO7+6K+jJx+AnUdNXGYBHCUb8jcdlybN4Dd36OpD k0lQ== X-Gm-Message-State: AOAM530+W6oqxs8zSiPcsEIoTup71oahzhFh8CdrA1kZruKAyBnCCP6r 4EDBTqycOzDDw3bgEhCq6eI= X-Received: by 2002:a63:e747:: with SMTP id j7mr1085881pgk.107.1596999700635; Sun, 09 Aug 2020 12:01:40 -0700 (PDT) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id b13sm18409857pjl.7.2020.08.09.12.01.39 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 09 Aug 2020 12:01:40 -0700 (PDT) Date: Sun, 9 Aug 2020 12:01:38 -0700 From: Guenter Roeck To: Finn Thain Cc: Benjamin Herrenschmidt , Joshua Thompson , Geert Uytterhoeven , linux-m68k@lists.linux-m68k.org, Laurent Vivier , Mark Cave-Ayland , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/9] macintosh/via-macii: Access autopoll_devs when inside lock Message-ID: <20200809190138.GA133890@roeck-us.net> References: <5952dd8a9bc9de90f1acc4790c51dd42b4c98065.1593318192.git.fthain@telegraphics.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5952dd8a9bc9de90f1acc4790c51dd42b4c98065.1593318192.git.fthain@telegraphics.com.au> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Sun, Jun 28, 2020 at 02:23:12PM +1000, Finn Thain wrote: > The interrupt handler should be excluded when accessing the autopoll_devs > variable. > I am quite baffled by this patch. Other than adding an unnecessary lock / unlock sequence, accessing a variable (which is derived from another variable) from inside or outside a lock does not make a difference. If autopoll_devs = devs & 0xfffe is 0 inside the lock, it will just as much be 0 outside the lock, and vice versa. Can you explain this in some more detail ? Not that is matters much since the change already made it into mainline, but I would like to understand what if anything I am missing here. Thanks, Guenter > Fixes: d95fd5fce88f0 ("m68k: Mac II ADB fixes") # v5.0+ > Tested-by: Stan Johnson > Signed-off-by: Finn Thain > --- > drivers/macintosh/via-macii.c | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/drivers/macintosh/via-macii.c b/drivers/macintosh/via-macii.c > index ac824d7b2dcfc..6aa903529570d 100644 > --- a/drivers/macintosh/via-macii.c > +++ b/drivers/macintosh/via-macii.c > @@ -270,15 +270,12 @@ static int macii_autopoll(int devs) > unsigned long flags; > int err = 0; > > + local_irq_save(flags); > + > /* bit 1 == device 1, and so on. */ > autopoll_devs = devs & 0xFFFE; > > - if (!autopoll_devs) > - return 0; > - > - local_irq_save(flags); > - > - if (current_req == NULL) { > + if (autopoll_devs && !current_req) { > /* Send a Talk Reg 0. The controller will repeatedly transmit > * this as long as it is idle. > */