Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp176912rdb; Thu, 21 Dec 2023 06:17:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IHJDA60qT9evw4Csm/gbxQUJMAKF4s4VMbjwDvBeCjCMfJiqpm6L4yUKduO6OitSU/ky48V X-Received: by 2002:a17:906:74c5:b0:a23:6f2e:bc68 with SMTP id z5-20020a17090674c500b00a236f2ebc68mr2720127ejl.53.1703168225587; Thu, 21 Dec 2023 06:17:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703168225; cv=none; d=google.com; s=arc-20160816; b=cF/HtwLq1BFIeWZ3uSH3LiHm86kjgzhUCwl7vYga8rnCsvjJ6HJBEFubUhD9Gu+ws4 6ESaWOiqKl2fBqwbFc1OD4gPByLD6sZF2qzkdoqecGE6rq5sAp5SLD13Wa+H9fz9NZYq /dGWWazuEDdc/3NnnAKKdPNoWFqUMSWmV9IvlzaT2rZM2dSvkK/JwNQeoWgezSbV2ymk r6YQL5G57plHhTWqnfL9IGbU8ubfZdWonuhYVPP8QECC2QHK6XVBGCyJ7Jn/Dw7M3jUA AgSWzcd7a5O2Npy1RCvhFBVi+8dfQVWpnO4mrmKEWGO6wVx8oMgaEW/ykVgwIHYrZyAk /4ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=hpiGQJLss2Chu2YZpApe+7wTw2CwSlTwEsdtaMpgTh0=; fh=eKj/bgldlybWABnWqmYLMaU0FSWwrRDFdVpgH/wMaU8=; b=aN6/FgbmwfY8rpPRVhxESfyfmdRMiJzyshFnsnyDmNVpQ6vIlYhm4TLaxYTt+U8n+T 2116nU5P36xi9OVyLadKQ37L7bu9ZBUvDFRVqZEovpPxaQJbqGLcF32R4Jd7uUODuHBb /VaGPTu7qXaog16Y9zpiM2AJItJ/dM0PAkpiFzIhIDQtSg5RJwJAxjHwig3C8LmnbskL wkazzWUCRfyGCEqlNgfUzfVEoKM445O78HuxizgsqeZMw6Q2Oee2dyaVlxoA5AEyJZZU 5bF8mbs46HaiUZwDjazICAIJ1ni1tMk6ulkpEyoTx0k043cpvQWFsP1GmR+BDjni7bAv adSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Lrq/D0C6"; spf=pass (google.com: domain of linux-kernel+bounces-8551-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8551-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id c13-20020a170906694d00b00a230f5549dcsi902102ejs.947.2023.12.21.06.17.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 06:17:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8551-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Lrq/D0C6"; spf=pass (google.com: domain of linux-kernel+bounces-8551-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8551-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 5F2A41F28A6D for ; Thu, 21 Dec 2023 14:07:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1274D6D6D5; Thu, 21 Dec 2023 14:06:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Lrq/D0C6" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 925D053A08; Thu, 21 Dec 2023 14:06:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703167582; x=1734703582; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=KwEyfYTQR1NbPVQsohEkV2RHgj/9+6Ry7VEJomez00U=; b=Lrq/D0C6Y6/9vZz3K1xFaaxTV3S7kY/YAdGTyJhlCSWj6hczw0VXyg6o lSkmUhvRdt2PS+z39Wk09H/IVHXoWB8lM7J0Q4PxiY1RLShiWKc/M0a48 0i9PLXH+tacREIhjc1oPKE9IA7SqikiPFDMRxE2Y5xYwAuVC3BhFEJ69a UHP6qDuP98aJheoucdiE6HmwSnTxGDq5ZqpwrGAYNuChVOCJskDTwCX39 vEV4QESTlF3PONJsGkZSb+ozLNEaU55C9uKy4MCSMUefnp1cLesZzUeWJ lYAgcew/7eAr/+m4tC4RQnAGglgO0nbyw4JlvyHAtu36P3Z6vK3F6g3Q+ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10930"; a="398762962" X-IronPort-AV: E=Sophos;i="6.04,293,1695711600"; d="scan'208";a="398762962" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Dec 2023 06:06:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10930"; a="805612857" X-IronPort-AV: E=Sophos;i="6.04,293,1695711600"; d="scan'208";a="805612857" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 21 Dec 2023 06:06:09 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 9D6ACE6; Thu, 21 Dec 2023 16:06:08 +0200 (EET) From: Andy Shevchenko To: Vadim Fedorenko , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Lemon , Vadim Fedorenko , Richard Cochran , Andy Shevchenko Subject: [PATCH net-next v1 1/1] ptp: ocp: Use DEFINE_RES_*() in place Date: Thu, 21 Dec 2023 16:06:07 +0200 Message-ID: <20231221140607.2760115-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit There is no need to have an intermediate functions as DEFINE_RES_*() macros are represented by compound literals. Just use them in place. Signed-off-by: Andy Shevchenko --- drivers/ptp/ptp_ocp.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c index 4021d3d325f9..306353a69231 100644 --- a/drivers/ptp/ptp_ocp.c +++ b/drivers/ptp/ptp_ocp.c @@ -1716,20 +1716,6 @@ ptp_ocp_get_mem(struct ptp_ocp *bp, struct ocp_resource *r) return __ptp_ocp_get_mem(bp, start, r->size); } -static void -ptp_ocp_set_irq_resource(struct resource *res, int irq) -{ - struct resource r = DEFINE_RES_IRQ(irq); - *res = r; -} - -static void -ptp_ocp_set_mem_resource(struct resource *res, resource_size_t start, int size) -{ - struct resource r = DEFINE_RES_MEM(start, size); - *res = r; -} - static int ptp_ocp_register_spi(struct ptp_ocp *bp, struct ocp_resource *r) { @@ -1741,15 +1727,15 @@ ptp_ocp_register_spi(struct ptp_ocp *bp, struct ocp_resource *r) int id; start = pci_resource_start(pdev, 0) + r->offset; - ptp_ocp_set_mem_resource(&res[0], start, r->size); - ptp_ocp_set_irq_resource(&res[1], pci_irq_vector(pdev, r->irq_vec)); + res[0] = DEFINE_RES_MEM(start, r->size); + res[1] = DEFINE_RES_IRQ(pci_irq_vector(pdev, r->irq_vec)); info = r->extra; id = pci_dev_id(pdev) << 1; id += info->pci_offset; p = platform_device_register_resndata(&pdev->dev, info->name, id, - res, 2, info->data, + res, ARRAY_SIZE(res), info->data, info->data_size); if (IS_ERR(p)) return PTR_ERR(p); @@ -1768,11 +1754,11 @@ ptp_ocp_i2c_bus(struct pci_dev *pdev, struct ocp_resource *r, int id) info = r->extra; start = pci_resource_start(pdev, 0) + r->offset; - ptp_ocp_set_mem_resource(&res[0], start, r->size); - ptp_ocp_set_irq_resource(&res[1], pci_irq_vector(pdev, r->irq_vec)); + res[0] = DEFINE_RES_MEM(start, r->size); + res[1] = DEFINE_RES_IRQ(pci_irq_vector(pdev, r->irq_vec)); return platform_device_register_resndata(&pdev->dev, info->name, - id, res, 2, + id, res, ARRAY_SIZE(res), info->data, info->data_size); } -- 2.43.0.rc1.1.gbec44491f096