Received: by 10.213.65.68 with SMTP id h4csp258276imn; Tue, 20 Mar 2018 02:47:30 -0700 (PDT) X-Google-Smtp-Source: AG47ELt0yc4lQysKS4UBaPKY/JVVO0s3l0WXmjJ93hhj9OayeYbmM8m41RrsEtvIbTyx+QYi3Xep X-Received: by 10.98.72.10 with SMTP id v10mr13086617pfa.148.1521539250054; Tue, 20 Mar 2018 02:47:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521539250; cv=none; d=google.com; s=arc-20160816; b=deIKht9ozwMvMfkSDshM+KL5vt/HyeA1nHaCKZZ4pWBopY7k5LDaD+6W5zoC9qOOt3 /Zj2RnHENx3pEiGvd2Bnp7/HP6vMNEhgysXuup5OLuCbLp8Z8/de/4Tm9eMXhYoUuZQq 1rKHTC7jjfkKF8lxzOunLcovNcROGRurdQn5hoGBX0dIEoRZcGwisI0NwP8t6HAQPslU x3iVnLf/JYeL0IIk2jT0m6IPvTK1d/mne3LBAsZE6a1n3gdCFoV7HvAddV92RkVwXg9+ 5D9puqQYIER9np2jGgkykljwe5Nid29180Ld4gW0bvcbTm7lW0m1JWcm5RYV34OGN4rJ yt0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=sR//iwHBQ0kK2xcRarv08ZQ6X+Tl4C85JJQUyTjize8=; b=mFKE/ghKJ9sAR3uXAQwFhdgRNEQbInk+65BIXQ1GMMFe0T+RVUTW7dCNKqE+6ATKez 1IHtW6CXA8dUJnOsfxYOzvGmPcyguREdC+yY06FiKWYIAeWI8FXJHAyozSTqbLl0LAHP KLDfs2cXVdHmoIatZFNiXsuOesTHbLzKMin4NWQc2n5r5ZsGDBGZYXDABsIT7+gBWLHr PjtB+k6zTAEiCZxcloJ3TcE69gAQI0rzJaEaSK3KRYHvP5ywfgLPKipNXUBF/A4uE5jj HkUARJbnoMKDupG6de1h6+MXSerzQMihtOlaYG3dEtSHEZCLkiIPtdMlwCSzt1Ar2gaK ZWwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=jw4dF2yZ; 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 g11si966906pgp.24.2018.03.20.02.47.12; Tue, 20 Mar 2018 02:47:30 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=jw4dF2yZ; 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 S1752591AbeCTJoc (ORCPT + 99 others); Tue, 20 Mar 2018 05:44:32 -0400 Received: from mail-qk0-f194.google.com ([209.85.220.194]:34845 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752562AbeCTJoY (ORCPT ); Tue, 20 Mar 2018 05:44:24 -0400 Received: by mail-qk0-f194.google.com with SMTP id s188so908846qkb.2; Tue, 20 Mar 2018 02:44:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=sR//iwHBQ0kK2xcRarv08ZQ6X+Tl4C85JJQUyTjize8=; b=jw4dF2yZNGHdIpvH8yF5b9tLJpYB6lQsQ9ZmnVyjHnAm+cGHyZZdZ1XB/8K3+JBmnk zC6ZTumMh8TJmZ/Eggdiv7RQjtEXZ/nO36GGGIznrKQVV45OKif/fPS/CFe7RaDUBuQA SL4B43efp7O/5uIK07jgyC2wr7b+as+/9BFptgKjwa/sOXLV7Ae6mB6qBTDDRIBPKJXA rbvAjaLoLJShvbSdu8mP15XRV1P//AZaEZrD8nkJCeB84YbX+VQe072DVPJAhKtXoN3G 9m6eT4dpGj1esRCRl6h5AyZyH4GWEW7gLQ+iwr23xd6KkDUT91YWE4XOQZdTVTDj/Tal ILOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=sR//iwHBQ0kK2xcRarv08ZQ6X+Tl4C85JJQUyTjize8=; b=gDck0aGZJu4WD0pSckjXfjhyzOwjBjtXV1dAVo6N6DL9JYi4NxCy7pWujdxr2fLBRl CByD3INTPehk1yWO4IehGJLuhqUOSGTUTsmAg1CBbq1oC77EIiZjsICRDQEZD943rQWD MZ4F7JSo4cWfAS0lp4BUoQXbbSS2bGJ/HCA1omY2JnUwvPzjSyonOUGE+YbtC7+jPLmr Ln5H/0CvlAOO/fQJipwIZ/U6Pv4GkmdDXV8V5AsryN2rIarzXOG12xj9mN+rTkK+qyT/ sUu424WyZ+KP1qD3Gtx+IgmHLLvV541o73CRkSpYq5Qt1n9iov12OblMVAc7cfAfcbYz zXCQ== X-Gm-Message-State: AElRT7F35jjCTvFALs1hfjj0TZppuoJi+OWGTEiTVitMMHJ+74lTd6QR zh+CxiWemLW8AirMmX0rugt11NCsZ8OnAxkFgyI= X-Received: by 10.55.24.214 with SMTP id 83mr23148898qky.267.1521539062222; Tue, 20 Mar 2018 02:44:22 -0700 (PDT) MIME-Version: 1.0 Received: by 10.200.54.147 with HTTP; Tue, 20 Mar 2018 02:44:21 -0700 (PDT) In-Reply-To: <20180317181936.14468be2@archlinux> References: <1521124947-18950-1-git-send-email-mnarani@xilinx.com> <20180316201925.GA18013@himanshu-Vostro-3559> <20180317181936.14468be2@archlinux> From: Geert Uytterhoeven Date: Tue, 20 Mar 2018 10:44:21 +0100 X-Google-Sender-Auth: _qelortKrrBYt9sjMaKgM9-i4MM Message-ID: Subject: Re: [RFC PATCH] iio: adc: Add Xilinx AMS driver To: Jonathan Cameron Cc: Himanshu Jha , Manish Narani , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald , Michal Simek , Lee Jones , Mark Brown , Arnaud Pouliquen , quentin.schulz@free-electrons.com, Linus Walleij , Ksenija Stanojevic , Arnd Bergmann , martenli@axis.com, jan.kiszka@siemens.com, Lukas Wunner , vilhelm.gray@gmail.com, Geert Uytterhoeven , Fabio Estevam , jackoalan@gmail.com, mnarani@xilinx.com, mike.looijmans@topic.nl, alexander.sverdlin@gmail.com, Jacopo Mondi , Linux Kernel Mailing List , linux-iio@vger.kernel.org, Linux ARM Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Mar 17, 2018 at 7:19 PM, Jonathan Cameron wrote: > On Sat, 17 Mar 2018 01:49:25 +0530 > Himanshu Jha wrote: > >> On Thu, Mar 15, 2018 at 08:12:27PM +0530, Manish Narani wrote: >> > The AMS includes an ADC as well as on-chip sensors that can be used to >> > sample external voltages and monitor on-die operating conditions, such as >> > temperature and supply voltage levels. The AMS has two SYSMON blocks. >> > PL-SYSMON block is capable of monitoring off chip voltage and temperature. >> > PL-SYSMON block has DRP, JTAG and I2C interface to enable monitoring from >> > external master. Out of these interface currently only DRP is supported. >> > Other block PS-SYSMON is memory mapped to PS. >> > >> > The AMS can use internal channels to monitor voltage and temperature >> > as well as one primary and up to 16 auxiliary channels for measuring >> > external voltages. >> > >> > The voltage and temperature monitoring channels also have event >> > capability which allows to generate an interrupt when their value >> > falls below or raises above a set threshold. >> > >> > Signed-off-by: Manish Narani >> > --- >> >> [..] >> >> > +static const struct of_device_id ams_of_match_table[] = { >> > + { .compatible = "xlnx,zynqmp-ams", &ams_pl_apb }, >> > + { } >> > +}; >> > +MODULE_DEVICE_TABLE(of, ams_of_match_table); >> >> [..] >> >> > +static int ams_probe(struct platform_device *pdev) >> > +{ >> > + struct iio_dev *indio_dev; >> > + struct ams *ams; >> > + struct resource *res; >> > + const struct of_device_id *id; >> > + int ret; >> > + >> > + if (!pdev->dev.of_node) >> > + return -ENODEV; >> > + >> > + id = of_match_node(ams_of_match_table, pdev->dev.of_node); >> > + if (!id) >> > + return -ENODEV; >> >> Is the above check required ? >> >> Isn't the probe function called if and only if a match is found in >> ams_of_match_table[] since it is a pure OF driver ? >> >> And therefore the above condition would never happen! > Agreed in principle. However, from a reviewer point of view, it is sometimes > easier to have an error check that can never happen than have to check whether > or not it can. Hence I'd keep this in place (well actually not because there > are better ways of doing this block of code, but that is unconnected to your > comment Himanshu!) You can avoid the intermediate (and avoid reviewers wondering ;-) by just writing instead: ams->pl_bus = of_device_get_match_data(&pdev->dev); Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds