From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF7E5C432C3 for ; Fri, 15 Nov 2019 04:26:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 98AD4206DC for ; Fri, 15 Nov 2019 04:26:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573791994; bh=9wOq687Qi/2lX8IlVmx3X62wxNLXabR/kcOYgP+5Zic=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=Gzr5bo/FjPkfeh75ssZ5vS07khu1N2fbblGz8+wHsP/6xEPXbffYjgdsPkooNYmeg M2gtwbeytEh21z2rnrmXXDRBuGsGaXpUPaTS8jId1e9zbj+/aBp3RLrZFdnxxUZoRj Z/OCBXqRZiZdcONDxCwkpq6IHbUqZRA6LFqppPDU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727149AbfKOE0b (ORCPT ); Thu, 14 Nov 2019 23:26:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:50124 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726661AbfKOE0b (ORCPT ); Thu, 14 Nov 2019 23:26:31 -0500 Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com [209.85.222.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 760A020731; Fri, 15 Nov 2019 04:26:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573791990; bh=9wOq687Qi/2lX8IlVmx3X62wxNLXabR/kcOYgP+5Zic=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=KRpj0jxqSegt9Nw4hWezOFc+3piXWWS0uzU6orlkh5W/H0zEhswSnT8XaLD7HuLtl 7oHNud3SfJmDxTgZ33qFavoPYuHMwP59ZF93vdykTnucwKJyjd3s/0RUwBlDBMwson RMC9Epl151y4HMRqHoOmLSH2j+LfU+ftqc9i7S7w= Received: by mail-qk1-f171.google.com with SMTP id m125so7097973qkd.8; Thu, 14 Nov 2019 20:26:30 -0800 (PST) X-Gm-Message-State: APjAAAUE7B22djlh3bhDr1bgenZ1puDZKlUVv9mDHXGiqc0xoN1Ltnms BTL6PDC8BJl6rcaclxJ/GfY/0LOcsSwv1Hn2RDQ= X-Google-Smtp-Source: APXvYqyLFzHjZ7tEQMeLkCQSkpPg0rZdqFl6WRIPEi5xIjuml+zSKU9pde3u+lplCRandR9s/b1zLnOoGmwvymczkds= X-Received: by 2002:a37:9d44:: with SMTP id g65mr10614078qke.302.1573791989555; Thu, 14 Nov 2019 20:26:29 -0800 (PST) MIME-Version: 1.0 References: <20191108130123.6839-1-linux@rasmusvillemoes.dk> <20191108130123.6839-33-linux@rasmusvillemoes.dk> In-Reply-To: <20191108130123.6839-33-linux@rasmusvillemoes.dk> From: Timur Tabi Date: Thu, 14 Nov 2019 22:25:52 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 32/47] serial: ucc_uart: use of_property_read_u32() in ucc_uart_probe() To: Rasmus Villemoes Cc: Qiang Zhao , Li Yang , Christophe Leroy , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel , lkml , Scott Wood , linux-serial@vger.kernel.org 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 Fri, Nov 8, 2019 at 7:03 AM Rasmus Villemoes wrote: > > + if (of_property_read_u32(np, "cell-index", &val) && > + of_property_read_u32(np, "device-id", &val)) { I know that this is technically correct, but it's obfuscated IMHO. 'val' is set correctly only when of_property_read_u32(...) is "false", which is doubly-weird because of_property_read_u32(...) doesn't actually return a boolean. I would rather you break this into two if-statements like the original code. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E5EDC432C3 for ; Fri, 15 Nov 2019 04:28:22 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0727B206DC for ; Fri, 15 Nov 2019 04:28:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="KRpj0jxq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0727B206DC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 47Dlhg6XyzzF7Zh for ; Fri, 15 Nov 2019 15:28:19 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=198.145.29.99; helo=mail.kernel.org; envelope-from=timur@kernel.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="KRpj0jxq"; dkim-atps=neutral Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 47Dlfd5VM9zF5Rg for ; Fri, 15 Nov 2019 15:26:33 +1100 (AEDT) Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com [209.85.222.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6A1FB2072B for ; Fri, 15 Nov 2019 04:26:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573791990; bh=9wOq687Qi/2lX8IlVmx3X62wxNLXabR/kcOYgP+5Zic=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=KRpj0jxqSegt9Nw4hWezOFc+3piXWWS0uzU6orlkh5W/H0zEhswSnT8XaLD7HuLtl 7oHNud3SfJmDxTgZ33qFavoPYuHMwP59ZF93vdykTnucwKJyjd3s/0RUwBlDBMwson RMC9Epl151y4HMRqHoOmLSH2j+LfU+ftqc9i7S7w= Received: by mail-qk1-f171.google.com with SMTP id m16so7084198qki.11 for ; Thu, 14 Nov 2019 20:26:30 -0800 (PST) X-Gm-Message-State: APjAAAXLGaMIRlhDDaB+WSE9lPVKanlrL7qiZg6+vFLDaAuexu7rWNXw 2RqGIUqST4/eNMw4nnVGGH70IbDVxKde4yrl8Ns= X-Google-Smtp-Source: APXvYqyLFzHjZ7tEQMeLkCQSkpPg0rZdqFl6WRIPEi5xIjuml+zSKU9pde3u+lplCRandR9s/b1zLnOoGmwvymczkds= X-Received: by 2002:a37:9d44:: with SMTP id g65mr10614078qke.302.1573791989555; Thu, 14 Nov 2019 20:26:29 -0800 (PST) MIME-Version: 1.0 References: <20191108130123.6839-1-linux@rasmusvillemoes.dk> <20191108130123.6839-33-linux@rasmusvillemoes.dk> In-Reply-To: <20191108130123.6839-33-linux@rasmusvillemoes.dk> From: Timur Tabi Date: Thu, 14 Nov 2019 22:25:52 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 32/47] serial: ucc_uart: use of_property_read_u32() in ucc_uart_probe() To: Rasmus Villemoes Content-Type: text/plain; charset="UTF-8" X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lkml , Li Yang , Scott Wood , linux-serial@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel , Qiang Zhao Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Fri, Nov 8, 2019 at 7:03 AM Rasmus Villemoes wrote: > > + if (of_property_read_u32(np, "cell-index", &val) && > + of_property_read_u32(np, "device-id", &val)) { I know that this is technically correct, but it's obfuscated IMHO. 'val' is set correctly only when of_property_read_u32(...) is "false", which is doubly-weird because of_property_read_u32(...) doesn't actually return a boolean. I would rather you break this into two if-statements like the original code. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 040E4C43215 for ; Fri, 15 Nov 2019 04:26:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D0165206DC for ; Fri, 15 Nov 2019 04:26:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Kbmbifnj"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="KRpj0jxq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D0165206DC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WSx0+0cFB9ABgbTbFLeNxMWW37qnQZ1Fc8atFnTewzg=; b=KbmbifnjoPALRX GDOkKE5oMiRf5sycxNvz/Xr0KLsu3jyaxMVupIHK0SuR7YXZGteyfRH515QqMyFQIQi8LXWRh6XBQ qd3foSct1+j/mN/nfuKxDG9VaDaGPehSmGgzz4WOaT6+/TSz/jQ5e3eYimResA4gNBn05Avk1T5D+ n0tDzYiKuptdaG+plLUF1GOIjPX/M9B3a1PMpC4941imOifn83rpdy41CQnqmo5jAA3WTsGGG65A5 HIfLx4kBWaE1aiB69M3XVVdRS4pu+2GUal7i7PAXbWT2X1xCt3dSdI/th2MIVrUqDGZZBM1lkWXLy FhyVu6XCtWzbt+s2s2iw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iVTBq-0006uR-EM; Fri, 15 Nov 2019 04:26:34 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iVTBn-0006tx-B1 for linux-arm-kernel@lists.infradead.org; Fri, 15 Nov 2019 04:26:32 +0000 Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 67C19206DC for ; Fri, 15 Nov 2019 04:26:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573791990; bh=9wOq687Qi/2lX8IlVmx3X62wxNLXabR/kcOYgP+5Zic=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=KRpj0jxqSegt9Nw4hWezOFc+3piXWWS0uzU6orlkh5W/H0zEhswSnT8XaLD7HuLtl 7oHNud3SfJmDxTgZ33qFavoPYuHMwP59ZF93vdykTnucwKJyjd3s/0RUwBlDBMwson RMC9Epl151y4HMRqHoOmLSH2j+LfU+ftqc9i7S7w= Received: by mail-qk1-f169.google.com with SMTP id e2so7117904qkn.5 for ; Thu, 14 Nov 2019 20:26:30 -0800 (PST) X-Gm-Message-State: APjAAAU5blu6YukPtSmpqV0LcglvMsEZJJVtQrcw3aNW+jpLdSq9V7Tq HY6VTzsMG1RYddk/ELk4UIgFYd+huQdOwZBNpNI= X-Google-Smtp-Source: APXvYqyLFzHjZ7tEQMeLkCQSkpPg0rZdqFl6WRIPEi5xIjuml+zSKU9pde3u+lplCRandR9s/b1zLnOoGmwvymczkds= X-Received: by 2002:a37:9d44:: with SMTP id g65mr10614078qke.302.1573791989555; Thu, 14 Nov 2019 20:26:29 -0800 (PST) MIME-Version: 1.0 References: <20191108130123.6839-1-linux@rasmusvillemoes.dk> <20191108130123.6839-33-linux@rasmusvillemoes.dk> In-Reply-To: <20191108130123.6839-33-linux@rasmusvillemoes.dk> From: Timur Tabi Date: Thu, 14 Nov 2019 22:25:52 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 32/47] serial: ucc_uart: use of_property_read_u32() in ucc_uart_probe() To: Rasmus Villemoes X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191114_202631_402316_8283C220 X-CRM114-Status: UNSURE ( 8.62 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Christophe Leroy , lkml , Li Yang , Scott Wood , linux-serial@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel , Qiang Zhao Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Nov 8, 2019 at 7:03 AM Rasmus Villemoes wrote: > > + if (of_property_read_u32(np, "cell-index", &val) && > + of_property_read_u32(np, "device-id", &val)) { I know that this is technically correct, but it's obfuscated IMHO. 'val' is set correctly only when of_property_read_u32(...) is "false", which is doubly-weird because of_property_read_u32(...) doesn't actually return a boolean. I would rather you break this into two if-statements like the original code. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel