From patchwork Wed Nov 29 22:21:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "David E. Box" X-Patchwork-Id: 171635 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6359:296:b0:164:83eb:24d7 with SMTP id ek22csp16103rwb; Wed, 29 Nov 2023 14:22:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IHJQ/q397bihdeAPOGI9aQmi3nlpstLeopz8BR01bE0OLNfqC2U49yuHuqDE6eRP0xnhzft X-Received: by 2002:a17:90b:1d09:b0:280:c98f:2090 with SMTP id on9-20020a17090b1d0900b00280c98f2090mr25223446pjb.32.1701296563642; Wed, 29 Nov 2023 14:22:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701296563; cv=none; d=google.com; s=arc-20160816; b=t0+6P0Q/xO97LOcAfP+rbl/5JCUSUcApUUOhyx0jnFxPgF9VrlFAOE+4MJA+nwcl6+ G6o0o2FS4xxXL2L5Iax57Y+KBQj1ixp2oL+5WyktW1oIWZs7EkSukAoYWUY0edyopfFT 3y4U7rS03fuhDk237JFQ+VFEQ3f1HwSHQDgFj6kgU4o7uuxLbWjWqP75M4+p/RcJ3Qjw gqVrIjOlX/dK9coC7Dr9XpQjR7aBSEBL45H0AOtxo9l6NDgv6MBIjleMOaRVFo01k3Yl uOyyynET5/6aoFiM2gJnxuASaeLOPVl/g/Olvd3Ho0XW74C/Pi/dRGDvm2ew5PmY7y+S 1JtA== 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=+v6IcAKzw1mUs9mcdPY44y3Lys9JXQH+m579O2uqcSs=; fh=d9G4dsZtlI8UONIvGKwhW94hCYEPGxy6CqYeKEG646A=; b=tSOuV07OwEax3tR8mXPpaUawU/zT0PFUtGE6XPZjmOUzl/0eC3gpdn4azIDrapb7k3 980OB7eOnFGtHLNLF6UZ4pD4FOBThEnWxwc7q+3wL9x+SB2yGjFCa1lbMtzwyMjz+AFy 629vsWkgtNF7ZZqYGz8TYFAVKpKo5aSRlTbV7+SvRmJGwQLEIl7oMB0chrUbj1KCEsRt c3M+qdI2VTtDAGu/dPLIAwNf4mQtvlH9meGBYgNn+rainkFLwZPuiqo93fd8QTBv85jB +jahDvZQXRLM9g3kzH83vO5lIAoJN0noJk8ewutrr9RbmAFkMyQQwhBD75ra0Lsw9Lsr 9WGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=m8dYxSsW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id e17-20020a17090a9a9100b00285b3a7912csi2092329pjp.100.2023.11.29.14.22.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 14:22:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=m8dYxSsW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id 25C0A80C8DE1; Wed, 29 Nov 2023 14:22:13 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343610AbjK2WVq (ORCPT + 99 others); Wed, 29 Nov 2023 17:21:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234865AbjK2WVe (ORCPT ); Wed, 29 Nov 2023 17:21:34 -0500 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6143C9; Wed, 29 Nov 2023 14:21:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701296500; x=1732832500; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=xvZYvHgO1aPnYX1bisLdg94DIXjNqrQoBT9Flv01IZY=; b=m8dYxSsWIwKIM1Ut0G6DiiMx9x4clXiFz9UO57FSFUUL4jUar7GMXJbK jlgpNqK28yqq/qOxb/SW5fe3REWjgRperIQ2YXEvVHxToM7Nw4ujAMaKj qTQoMw16EfmUIgZzlBc+Wduy/vJJOQc43MTPJBAxDLJ/Zb12R2fHZ+QUe JK2aYUy8rEVVrZN2PV1OQrn5AiciVN0KejrVp5QRFxLu5/Sa6h3HmK71n dYjROWCwJ2jS0BRkhT/WJMhwjvHPqwo8+XImD6dxhhXNPReNgDPurccyR vZua7d8WfiKi4w8Ex/l2Y7q2lbn7S5jvnenLOz++dqWVyqxLE293lu4dl g==; X-IronPort-AV: E=McAfee;i="6600,9927,10909"; a="11937000" X-IronPort-AV: E=Sophos;i="6.04,237,1695711600"; d="scan'208";a="11937000" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2023 14:21:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10909"; a="798070417" X-IronPort-AV: E=Sophos;i="6.04,237,1695711600"; d="scan'208";a="798070417" Received: from linux.intel.com ([10.54.29.200]) by orsmga008.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2023 14:21:33 -0800 Received: from debox1-desk4.lan (unknown [10.209.108.167]) by linux.intel.com (Postfix) with ESMTP id 686685807E2; Wed, 29 Nov 2023 14:21:33 -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 V6 06/20] platform/x86/intel/vsec: Assign auxdev parent by argument Date: Wed, 29 Nov 2023 14:21:18 -0800 Message-Id: <20231129222132.2331261-7-david.e.box@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231129222132.2331261-1-david.e.box@linux.intel.com> References: <20231129222132.2331261-1-david.e.box@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 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 groat.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 (groat.vger.email [0.0.0.0]); Wed, 29 Nov 2023 14:22:13 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783938745505202514 X-GMAIL-MSGID: 1783938745505202514 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 Reviewed-by: Ilpo Järvinen --- V6 - No change 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 27e8698ebe5e..329ba03a6da0 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; + ret = xa_alloc(&auxdev_array, &intel_vsec_dev->id, intel_vsec_dev, PMT_XA_LIMIT, GFP_KERNEL); if (ret < 0) { @@ -120,9 +123,6 @@ int intel_vsec_add_aux(struct pci_dev *pdev, struct device *parent, return id; } - if (!parent) - parent = &pdev->dev; - auxdev->id = id; auxdev->name = name; auxdev->dev.parent = parent; @@ -204,7 +204,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)); }