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=HEADER_FROM_DIFFERENT_DOMAINS, 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 61C4EC433DF for ; Tue, 26 May 2020 15:01:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 49E5520776 for ; Tue, 26 May 2020 15:01:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729744AbgEZPB3 (ORCPT ); Tue, 26 May 2020 11:01:29 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:35727 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729368AbgEZPBU (ORCPT ); Tue, 26 May 2020 11:01:20 -0400 Received: by mail-ed1-f65.google.com with SMTP id be9so17927985edb.2; Tue, 26 May 2020 08:01:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=/FQ3kSh6QRt/DhDlB1iVTGQKeiQZDzu9nHJXUdnImCk=; b=Z8t+0ViDna1GqYu0FuJehfRYS/Jcck7SOImRHZ2f5+vmElvDmKqdhGrbiza0PQFoTt nalsjBLJi9Q79s5g20dKy/e0n18q+Khn0/p8gZI9dZB80U15lLSz5qnhX5uFuzzbKZMn x4KQnDkvSIgBfa4AbLxdKL1EvjRfMBWoDNrluLDkp57sCOQeUdCYloCUmGkeI8BB/UiM BFijU6JOFX32772XYrmeN7bY3Van/jb3b2Cx4x+XfRsFWS45jAHdivc/2+2TpCLaRuUp SJGPZxO1vFMynhhnmaH0TetzpoXXnE++nOUcYcNNBGD/f3IluaaFR/rsXcd8W9rkqCX8 oOgA== X-Gm-Message-State: AOAM532oq7IL88Wpbca2U5c5H3ET+SSyEQZM5RVY+JNNatQj5lCvnEif xyEFbVHj1n4AUOfj+E6o9nCVPUlyq8qDssMj X-Google-Smtp-Source: ABdhPJzUcDOK5LS647ncdAETZsJMJ8+0djAcX5w/EM0H6iRkO7YVRDADM+BVObYTE4LLegacDOPiCg== X-Received: by 2002:a05:6402:31b5:: with SMTP id dj21mr21365281edb.160.1590505277038; Tue, 26 May 2020 08:01:17 -0700 (PDT) Received: from rocinante ([95.155.85.46]) by smtp.gmail.com with ESMTPSA id f13sm143194edk.36.2020.05.26.08.01.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 May 2020 08:01:15 -0700 (PDT) Date: Tue, 26 May 2020 17:01:14 +0200 From: Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= To: Alex Elder Cc: Greg Kroah-Hartman , Ulf Hansson , linux-pci@vger.kernel.org, Bjorn Andersson , Pavel Machek , linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org, Kevin Hilman , Julian Wiedmann , linux-acpi@vger.kernel.org, Jakub Kicinski , Dan Carpenter , Len Brown , linux-pm@vger.kernel.org, "James E.J. Bottomley" , Ursula Braun , Johan Hovold , greybus-dev@lists.linaro.org, John Stultz , Bjorn Helgaas , Felipe Balbi , Alex Elder , "Martin K. Petersen" , netdev@vger.kernel.org, linux-usb@vger.kernel.org, "Rafael J. Wysocki" , Karsten Graul , "David S. Miller" Subject: Re: [greybus-dev] [PATCH 1/8] driver core: Add helper for accessing Power Management callbacs Message-ID: <20200526150114.GB75990@rocinante> References: <20200525182608.1823735-1-kw@linux.com> <20200525182608.1823735-2-kw@linux.com> <20200526063334.GB2578492@kroah.com> <41c42552-0f4f-df6a-d587-5c62333aa6a8@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <41c42552-0f4f-df6a-d587-5c62333aa6a8@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hello Alex and Greg, [...] > This could just be: > > if (drv) > return drv->pm; > > return NULL; > > Or if you want to evoke passion in Greg: > > return drv ? drv->pm : NULL; > > -Alex > > > I hate ? : lines with a passion, as they break normal pattern mattching > > in my brain. Please just spell this all out: > > if (drv && drv->pm) > > return drv->pm; > > return NULL; > > > > Much easier to read, and the compiler will do the exact same thing. > > > > Only place ? : are ok to use in my opinion, are as function arguments. I will steer away from the ternary operator next time. Also, good to learn about Greg's preference. Thank you both! Krzysztof