Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp311551iob; Mon, 2 May 2022 20:58:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdRSTNUAxUkl05Jgv+8EztTE6ToFyny9HxZwbec6pgtYRbOomrHr3GN/g2mWKQlzQPmo3n X-Received: by 2002:a05:6a00:1805:b0:50d:ee59:b579 with SMTP id y5-20020a056a00180500b0050dee59b579mr7526508pfa.70.1651550296257; Mon, 02 May 2022 20:58:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651550296; cv=none; d=google.com; s=arc-20160816; b=RXZkE+LMV3APiEfmjWsNYw8kFg+L/vfGJC7BLk61lox41opyP4KJHMzDcAJ4VWh6HL iVpQdjzm9dM2Sut/zETwcsZPGNutJtwfga0DtM/jjVsZnl7ttWMza2yA0QMqLkTbRlyO THtloMWoReX/BA93TCIaf1xwmgaDmLBVxa2DXQF1L9vxVKBbUO0vg6LVcIKJUR/ahxKf q4b50XyrqgfuvqVWv+WGCtmNpEDxitZ5Rp7WTcERjiVffH6y1hP2uwamuE8PWyBIXDu9 I5rES0ADMGFwu8eALYz7fvtpeRoJOqWtQ0x70AH43Y1r/cc1x+xRf47lCHOfMTB0fcmg uGwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Wmzy06AlfvjgPQqWAaZNyXn7vugPs2fLADoVYfzK0Sc=; b=YrsvToFgvUa78cy0G9DJJI3b67OqPexA7H1ya1N6v9JCpxJL5U/R1MQSqWpIG2HFx+ GIUekd8y0cnvCvZ9fLN9qhExRTdFrm6JGcBS2xKsLtAfc4wnww+TXO0SoPVFaqzFl3gP jL4CnOaqFSf+J1boFcjPgWa6Hi7MITzfORHUImbFzrRqmsVJc33eFkZmGHiYR7zO0HLe IKAN1NCUyyqT6d1mQ6faPJymFSgqKpKpFX8hp2Oh4QFa2HRBBP1LGJMHT3ByaDBtU1ga Wv8xzTOQkdj+YrvscEnYDfRVpubSIhA/p6PomfVVtvdbe9Qtc2OjnZ10o7U75VXvNAEs 6DmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YcJ69Mxs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id f16-20020a17090a4a9000b001da37810fc6si1028855pjh.54.2022.05.02.20.58.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 20:58:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YcJ69Mxs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1C9BB3CA4C; Mon, 2 May 2022 20:58:14 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230466AbiECEBd (ORCPT + 99 others); Tue, 3 May 2022 00:01:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229480AbiECEBb (ORCPT ); Tue, 3 May 2022 00:01:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AFE636B77; Mon, 2 May 2022 20:58:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 253EBB81BE4; Tue, 3 May 2022 03:57:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 589D6C385A9; Tue, 3 May 2022 03:57:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651550277; bh=Cl5mLzkG+TTdpfzZTrXfX/qXJHGfkfoAd8qQBoaXi2o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YcJ69Mxs/0egoH/KoOxPB3yexeKFIvfqicqjGmBmRqA1j0B0WFCNgHAopqYY+yRQy mzbbT/hsRO8kK+0jXsHqc+Golxqn2efytgtN6PsVYY3FodNNrGRhMd3CxxkuPqTqJL m0KcR1SWkduqZlmLQ8yT5r2X93ZuAvjHcdT7XUs6lKdOGMx38ZRrn7K/JLTY4xH/Id asLXU4pqHu6fV5WS2uf/SipLHO6i8LWMomfFKzTGRWpvazPmiZzCsFcOIuWEt1Vop9 DtVgViFpNQ9E9kMYMaHPdzmlvehvI1YqBf4fOAIuXM3aasfbiz0coNItX3TcB+BWWK Cfs51zkdijRGw== Date: Tue, 3 May 2022 11:57:53 +0800 From: Tzung-Bi Shih To: Pali =?iso-8859-1?Q?Roh=E1r?= Cc: Wim Van Sebroeck , Guenter Roeck , Rob Herring , linux-watchdog@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] watchdog: max63xx_wdt: Add support for specifying WDI logic via GPIO Message-ID: References: <20220429131349.21229-1-pali@kernel.org> <20220429131349.21229-2-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220429131349.21229-2-pali@kernel.org> X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 29, 2022 at 03:13:49PM +0200, Pali Roh?r wrote: > @@ -27,6 +27,7 @@ > #include > #include > #include > +#include It would be better to keep them alphabetically. Anyway, they aren't sorted originally... > +static void max63xx_gpio_ping(struct max63xx_wdt *wdt) > +{ > + spin_lock(&wdt->lock); Does it really need to acquire the lock? It looks like the lock is to prevent concurrent accesses to the mmap in max63xx_mmap_ping() and max63xx_mmap_set(). > + gpiod_set_value_cansleep(wdt->gpio_wdi, 1); > + udelay(1); Doesn't it need to include for udelay()? > @@ -225,10 +240,19 @@ static int max63xx_wdt_probe(struct platform_device *pdev) > return -EINVAL; > } > > + wdt->gpio_wdi = devm_gpiod_get(dev, NULL, GPIOD_FLAGS_BIT_DIR_OUT); > + if (IS_ERR(wdt->gpio_wdi) && PTR_ERR(wdt->gpio_wdi) != -ENOENT) Use devm_gpiod_get_optional() to make the intent clear. Also, it gets rid of the check for -ENOENT. > + return dev_err_probe(dev, PTR_ERR(wdt->gpio_wdi), > + "unable to request gpio: %ld\n", > + PTR_ERR(wdt->gpio_wdi)); It doesn't need to again print for PTR_ERR(wdt->gpio_wdi). dev_err_probe() prints the error. > err = max63xx_mmap_init(pdev, wdt); > if (err) > return err; > > + if (!IS_ERR(wdt->gpio_wdi)) > + wdt->ping = max63xx_gpio_ping; Thus, the max63xx_gpio_ping() overrides max63xx_mmap_ping() if the GPIO was provided? It would be better to mention the behavior in the commit message. Also, could both the assignments of `wdt->gpio_wdi` and `wdt->ping` happen after max63xx_mmap_init()?