Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp93707rdh; Wed, 22 Nov 2023 20:05:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IH572TPPmdcWtgcy/mSo9O0NsVYo7sOX30WKYbOmb2NnPe/yGUAYgJ5aGDYEyXKsth4puVZ X-Received: by 2002:aca:2115:0:b0:3ad:f6ad:b9c5 with SMTP id 21-20020aca2115000000b003adf6adb9c5mr4598903oiz.59.1700712299772; Wed, 22 Nov 2023 20:04:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700712299; cv=none; d=google.com; s=arc-20160816; b=S/EbOS38XApimEu9Ol97X4XFUESQ1wYXihlPhWy6JAv0/tPfJK4Y3H0ObXBLK6c4gH YjveZkbqYbAOlmNdv8Ff1K2PR3ugTakd/4f8UMGy+S83U8h3bRx75qXvdZmVS+LvHIg9 cdH0BdusFfw4fisekIMqo6O9THmiAcYzLCWhhVfcWiScnKfd/cQT3f+G//ydlpdpzAWU g7Pc86BPYkJme4cDjN3+N8Ozaur2fHbQkMlHSKmniLSxtZwWCKOCRFeyDRWVhRQysKb8 GOzDDM3YPnvkN5cPoJ6SNXyUA/GEO5BrsL5fJcpcnqGs39ooUrZscC7Dd5SY0o28L0BL BS4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=8iNFzo7Ua09g/45rDFBUvl2phQ0OcFbZEWrok5vuXeQ=; fh=d9G4dsZtlI8UONIvGKwhW94hCYEPGxy6CqYeKEG646A=; b=1BRfF6RjSBVPQr8RlrBK4GSz46TScebK6wMobkq0MvuSzU8KP1ctPKpX+WXpre48g0 ZV5EUezuaIxiATqzp96QMIMaab3QrZPiidLOlHi2fa6H95x52MwMxNwt4anwd2S9HDHI kk5p3NSw74HGFd8Catuq5uRusPwBK8dgyB0gfYow5md4s6CFbVPmzidFU2gePXr/QPt/ 6dosBK09Eoex0MClQ1SY28YUnrgEq+7c/wVul6doINjSXwCYoK216jkMd8A72Ug8hzJI am3/0U4vSKuqEiIWWOe9NI1SgLGkiFpsmIuYZkn3Lq/attxFdmgB3MsKAHbVTD8XOz+2 VXwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Q4b7QTib; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id u2-20020a63d342000000b005be327e08afsi521359pgi.224.2023.11.22.20.04.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 20:04:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Q4b7QTib; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 85C9A807DE2D; Wed, 22 Nov 2023 20:04:50 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344519AbjKWEES (ORCPT + 99 others); Wed, 22 Nov 2023 23:04:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232912AbjKWEDw (ORCPT ); Wed, 22 Nov 2023 23:03:52 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7B081BE; Wed, 22 Nov 2023 20:03:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700712238; x=1732248238; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=ZNP+0mMTg9UYIFCYqwmcsOydsKIWsjAN9iCN8hOaigM=; b=Q4b7QTibKv6mnrdsAc/hnBQZ/saCvqsHtsDlHJNCNivGlGH7XwxmSapg 04/rizd0Kusyrvm2BMv/icWtZB9nEGWib4Fc+QF0v+HV0a0nMMiKnz0N7 8XGvMU5Wb/JmSJ9fxVJgbME8HhLOqr3qMM3KW9o1SwuQeNjfGNx28gmn1 BbTpofz9Re67vZIsnJfMRLSShpyUkWC8tfj+VbjS54rMD6I5iTJF92IF4 p2Xcq/m0v8SZlihRPha4o3vFAKddCpCd5iVAjpIzI04eD+fDKwnplbGIm gTpjiaCEvyFho7uf3wca4WCT8N0mCKyl4ltlcIu8X7KmzFeCO+5F6CRoe Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="389347945" X-IronPort-AV: E=Sophos;i="6.04,220,1695711600"; d="scan'208";a="389347945" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2023 20:03:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="801925648" X-IronPort-AV: E=Sophos;i="6.04,220,1695711600"; d="scan'208";a="801925648" Received: from linux.intel.com ([10.54.29.200]) by orsmga001.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2023 20:03:56 -0800 Received: from debox1-desk4.lan (snpatel1-mobl.amr.corp.intel.com [10.209.89.91]) by linux.intel.com (Postfix) with ESMTP id F14E7580D81; Wed, 22 Nov 2023 20:03:55 -0800 (PST) From: "David E. Box" To: linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, ilpo.jarvinen@linux.intel.com, rajvi.jingar@linux.intel.com Subject: [PATCH V5 05/20] platform/x86/intel/vsec: Assign auxdev parent by argument Date: Wed, 22 Nov 2023 20:03:40 -0800 Message-Id: <20231123040355.82139-6-david.e.box@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231123040355.82139-1-david.e.box@linux.intel.com> References: <20231123040355.82139-1-david.e.box@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,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 howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 22 Nov 2023 20:04:50 -0800 (PST) Instead of checking for a NULL parent argument in intel_vsec_add_aux() and then assigning it to the probed device, remove this check and just pass the device in the call. Since this function is exported, return -EINVAL if the parent is not specified. Signed-off-by: David E. Box --- V5 - New patch drivers/platform/x86/intel/vsec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/platform/x86/intel/vsec.c b/drivers/platform/x86/intel/vsec.c index 7dc3650f2757..7a717183c58b 100644 --- a/drivers/platform/x86/intel/vsec.c +++ b/drivers/platform/x86/intel/vsec.c @@ -103,6 +103,9 @@ int intel_vsec_add_aux(struct pci_dev *pdev, struct device *parent, struct auxiliary_device *auxdev = &intel_vsec_dev->auxdev; int ret, id; + if (!parent) + return -EINVAL; + mutex_lock(&vsec_ida_lock); id = ida_alloc(intel_vsec_dev->ida, GFP_KERNEL); mutex_unlock(&vsec_ida_lock); @@ -124,9 +127,6 @@ int intel_vsec_add_aux(struct pci_dev *pdev, struct device *parent, return ret; } - if (!parent) - parent = &pdev->dev; - auxdev->id = id; auxdev->name = name; auxdev->dev.parent = parent; @@ -212,7 +212,7 @@ static int intel_vsec_add_dev(struct pci_dev *pdev, struct intel_vsec_header *he * Pass the ownership of intel_vsec_dev and resource within it to * intel_vsec_add_aux() */ - return intel_vsec_add_aux(pdev, NULL, no_free_ptr(intel_vsec_dev), + return intel_vsec_add_aux(pdev, &pdev->dev, no_free_ptr(intel_vsec_dev), intel_vsec_name(header->id)); } -- 2.34.1