Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp914376ybg; Fri, 18 Oct 2019 09:12:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqyAFaeSe6ouiM7qLS47TaaSXOaYGWW3SOlI9FDLksrstBfFitYCWm8q5R5AJ9iPD0p7jZf8 X-Received: by 2002:a05:6402:12d4:: with SMTP id k20mr10552720edx.241.1571415130128; Fri, 18 Oct 2019 09:12:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571415130; cv=none; d=google.com; s=arc-20160816; b=cT0ptDMq6YmRpMNHK7NvhIzIPh9+E9ZM6mE1DwkV1LyNTmYJeRDWmRLGrcEoGtOI7u 7Id69xIYVyUfop18Z+P3u6kDaz1lWl0Z/44cjTqyeibFxwSxfccrYvehH1Pe1ovaAQf2 bwNYAvTxlth+x5tcoHnOdLS4NjAMqmiPYurge7ZBE6x67QhX0MRkzzxmQCc0aJ+hl7Uj wI+HDnpryvKM0a5NS5ZU4Zj6khmMjyToG5wUtXM7WunAyL9RiwFe+VCji7iTvK/Cr5WL kAlvXwUVSUKpWPFZnaxPBCyCYl1ldssnk9pM2/SYjRyopz5cnQVrd+A7PIPfWTw2+5lg dyPg== 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 :in-reply-to:references:mime-version; bh=V9F1NynHBe9lfMAB/ZrN6cWXHTh5u4L4sRwtLfhngWc=; b=NQ7SEiUF8sclQrQOaq889/nAEK7wh8SqrU9V22X/DG2t+RyBZgaikjwh5jwic/kcLQ zwNkyG8IzcuhrCFkEqtsw4+mLl4GEm2wO1xpqg0ZjAgkLnZ8gmCdls+YgkkWFxzIeITT lZNja/z/b72z18rOL76ElJGwmK7MUGJTVLsiKWVyFGbLTkEzgAKLCn5V7D9vncj+qph7 Fb9KCfgs4RW14hkj8qEs35bJMkAfBOS+NXV2Rdbid/nmCO9UbPTwHyG/Mk1uC4WC0W0h nMKJvSaiVF9QknjNukyYDKemnCXw94OYZeOOVKx2av1II1rQ1lPDDNbEtxoUFwvbjUYA U5dg== ARC-Authentication-Results: i=1; mx.google.com; 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 jx20si3595567ejb.291.2019.10.18.09.11.45; Fri, 18 Oct 2019 09:12:10 -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; 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 S2436822AbfJQNsF (ORCPT + 99 others); Thu, 17 Oct 2019 09:48:05 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:40616 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394727AbfJQNsE (ORCPT ); Thu, 17 Oct 2019 09:48:04 -0400 Received: by mail-qt1-f195.google.com with SMTP id m61so3629223qte.7; Thu, 17 Oct 2019 06:48:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=V9F1NynHBe9lfMAB/ZrN6cWXHTh5u4L4sRwtLfhngWc=; b=G+facC80VhcAvLi/e6A7TrduLWn0vD2qJhwCrXCQM3M5ILpu7FXJbXruo/38blvJR5 Q9oLLeaCrnK44x/5Iju8xFk4HjeGNEu8EJAtJzKdeJlU40QpeDu7KikFtBXkeL0EpofJ Wehvt2p6B7cM8Ub1BPoCUh1tIiWug2UFg00NAXwu2T5EdY7duo662MRQQA7vMfPtBnhr mSqkgU+scwS6+zqRnMWS7LazQ3L7sA34yyI+rqDVn03k9VJD5ALQzh3dMciU948nlxoP Ajitc4MmV6M46JL/91n4aTOi2mOmgoZmFwpYshjmkKfcEHKHbS4m3FA4/c2VYhRbCjXb m+VQ== X-Gm-Message-State: APjAAAXSOsXBzY9+d6+zJ5ejcNPbiEEoJ/ZVzs78OY1c9awftUPobS52 m83lQK0zdCOJUPsfVDy9gK4P7r7Z5trw6EQGUrU= X-Received: by 2002:a0c:c70a:: with SMTP id w10mr3972472qvi.222.1571320083293; Thu, 17 Oct 2019 06:48:03 -0700 (PDT) MIME-Version: 1.0 References: <20190930121520.1388317-1-arnd@arndb.de> <20190930121520.1388317-3-arnd@arndb.de> In-Reply-To: From: Arnd Bergmann Date: Thu, 17 Oct 2019 15:47:47 +0200 Message-ID: Subject: Re: [PATCH 3/3] crypto: inside-secure - Remove #ifdef checks To: Pascal Van Leeuwen Cc: Antoine Tenart , Herbert Xu , "David S. Miller" , Bjorn Helgaas , Pascal van Leeuwen , Kelsey Skunberg , "linux-crypto@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-pci@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 Thu, Oct 17, 2019 at 3:26 PM Pascal Van Leeuwen wrote: > > /* Register PCI driver */ > > - pcireg_rc = pci_register_driver(&safexcel_pci_driver); > > -#endif > > + ret = pci_register_driver(&safexcel_pci_driver); > > > > -#if IS_ENABLED(CONFIG_OF) > > /* Register platform driver */ > > - ofreg_rc = platform_driver_register(&crypto_safexcel); > > - #if IS_ENABLED(CONFIG_PCI) > > - /* Return success if either PCI or OF registered OK */ > > - return pcireg_rc ? ofreg_rc : 0; > > - #else > > - return ofreg_rc; > > - #endif > > -#else > > - #if IS_ENABLED(CONFIG_PCI) > > - return pcireg_rc; > > - #else > > - return -EINVAL; > > - #endif > > -#endif > > + if (IS_ENABLED(CONFIG_OF) && !ret) { > > > Hmm ... this would make it skip the OF registration if the PCIE > registration failed. Note that the typical embedded system will > have a PCIE subsystem (e.g. Marvell A7K/A8K does) but will have > the EIP embedded on the SoC as an OF device. > > So the question is: is it possible somehow that PCIE registration > fails while OF registration does pass? Because in that case, this > code would be wrong ... I don't see how it would fail. When CONFIG_PCI is disabled, pci_register_driver() does nothing, and the pci_driver as well as everything referenced from it will be silently dropped from the object file. If CONFIG_PCI is enabled, then the driver will be registered to the PCI subsystem, waiting for a device to show up, but the driver registration does not care about whether there is such a device. > Other than that, I don't care much how this code is implemented > as long as it works for both my use cases, being an OF embedded > device (on a SoC _with_ or _without_ PCIE support) and a device > on a PCIE board in a PCI (which has both PCIE and OF support). Yes, that should be fine. There are a lot of drivers that support multiple bus interfaces, and this is the normal way to handle them. Arnd