From patchwork Mon Feb 19 03:38:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raag Jadav X-Patchwork-Id: 202903 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1103330dyc; Sun, 18 Feb 2024 22:05:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWxIzNUKujZUjxsMrVt8uRa4zeZDRFBzIY8ClsuThn1PFnCtvOhbVd/hd26FcFnXGsCx2O5XuA+QHLRSR+5sEGlBSYssQ== X-Google-Smtp-Source: AGHT+IH6sRZzVY1ZZbO2LiV5clBYAImf2h+kA4ZwqIJ1iHFs7r3B/Hgpd+hqGcmjQjRPQBAmhjR8 X-Received: by 2002:a05:622a:134f:b0:42d:f2d0:a50 with SMTP id w15-20020a05622a134f00b0042df2d00a50mr8422458qtk.53.1708322727090; Sun, 18 Feb 2024 22:05:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708322727; cv=pass; d=google.com; s=arc-20160816; b=cE1Ae3JxX4EOGwJHfekCPjrU7VNJW9VOc2C3xCuiyeJvIQGJ1LiOIRJ3DH8TKtPZzj 3J1YrXnoVYXzStiiXxkWY7AolXbU3Kzwm+rfTJCsvm05vn8CULhRE606K4NgQvBx51BI anwhomofLRdXy94qjm8m2CFE097rZGr+WXX1gzEVRBv40QJXv2x0jwMdym3nVVZoUR5c 2aNClXUrft/wHudu5K91VAEs1d9mcbZPG9a+OntY9vr3/9gKP2dIcKT3diVsk1/IXr4m byPpdPOQluQ2vDFPk72TUcJQD5SeznQJDKE4eKCO98P512HllL//f5jiClsbIqdykHaW OuMg== ARC-Message-Signature: i=2; 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=sTdLLlfSzJMgcnhecFRz9uWWXzFIcZA/5wybGJ1y3y8=; fh=y/RjPbXBoPouJTPaYxwEImQW6x8GRiLpamQFwed/jf0=; b=vzdAMWT8pfUe6aHlH87R0Jo/4zGolBzha6xZCeOljGivWk4J51OkzDrIE9Z6cP1eV6 rLRHe8YWQZpo/OgFacSIpQo1nWGloFzsrZhmZsNbRb+GUn/FlDfYt0M/be0ueupV/MLc zylxNwfHLFuHzo6ilQkESAvlZyNGCORJ/OelIAbX50ebk3s8flFaZtxipnjlJgXwqIVE 3Jmsi6JKAfsHqiniFQe7vHJ7RATy1vaSM/nhx/aFtZDrUROrvdSKfxjDOkC2mrDxh06K BdeB/clCNXhUhypzHZa9F7/hu0A+96chk2fHYjB5WVNSVEJZEhrpuAihK2ue4gxGTPMW vgTQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="lMaEw+r/"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-70676-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70676-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id c10-20020ac87dca000000b0042dba5dad7asi5970172qte.456.2024.02.18.22.05.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 22:05:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70676-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="lMaEw+r/"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-70676-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70676-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 05BDD1C215C1 for ; Mon, 19 Feb 2024 03:39:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E9153FC10; Mon, 19 Feb 2024 03:39:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="lMaEw+r/" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (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 D76AE5220; Mon, 19 Feb 2024 03:38:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708313938; cv=none; b=F/liB8MPTv0RXupzGjg+Dl5JYbk6H5zONtQZI3IgjBmaDvi2Tb6x2lAZkRzQkEkuK5paSRtBhgsJ2mXb3mY+NRmEqw4Zgbbvzu0ALImd7UNkSSGjrHQfIEV+NOVLoSlkLL4tLvDcvkIICpVf9BeEQk/Rrd4lQoIyjhOpQGqhTZ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708313938; c=relaxed/simple; bh=IdENPDV8Ed3IxJBmvwAplc7Nj3XPC3wlnxCHbUH17Uk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PwAzeW0fZOIRxWDnaD23jqQtqBKc44TOUqqvlVtSbnb/2sYqFs1ycrCIJgFRgw7O+iSGeF22GbOzltDNfJ+pHKyrsXtBJGY5dCLbWzqjgidYez6MDgSr9IlPrmWshbt/wg3C8zNSXFj3Z0pfAUvfLu11R91ESx2mWIoN9quqUWs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=none smtp.mailfrom=ecsmtp.iind.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=lMaEw+r/; arc=none smtp.client-ip=198.175.65.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ecsmtp.iind.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708313937; x=1739849937; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IdENPDV8Ed3IxJBmvwAplc7Nj3XPC3wlnxCHbUH17Uk=; b=lMaEw+r/6C//tX4SV90OZr8PniIh3H2iwSAnKOZ1XxGFklTKkJp3Cv/T OAT2GiFcqImTEH1WINsyGSyjLolNXtvnijq+vnKUiyJyt4CiLgt7QwUmy kzz2ZGpcOq8Jt5u37NXnfU+2DaM1pPWS/gxTv+Q0dUejKBqrZZMXhPs6d FkkwCIHBCdzNs1WHq36s08/BiZAaGm0aFokydKrY4Aqx7BVbYTPAaGVJ4 K9YiLPelYkuJf8jXXY4JE0EpiaWA3KOXwcSCpVF+tbNXv2LLxDQQCFfps GLiAIi2MRtiBQwujHpAyb7U4sduXcXsR1Wrka0nUFlZjmIj9di9EdUOH1 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10988"; a="24838167" X-IronPort-AV: E=Sophos;i="6.06,170,1705392000"; d="scan'208";a="24838167" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Feb 2024 19:38:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,170,1705392000"; d="scan'208";a="4281849" Received: from inesxmail01.iind.intel.com ([10.223.57.40]) by fmviesa007.fm.intel.com with ESMTP; 18 Feb 2024 19:38:47 -0800 Received: from inlubt0316.iind.intel.com (inlubt0316.iind.intel.com [10.191.20.213]) by inesxmail01.iind.intel.com (Postfix) with ESMTP id C557071913; Mon, 19 Feb 2024 09:08:45 +0530 (IST) Received: by inlubt0316.iind.intel.com (Postfix, from userid 12101951) id C2BE11600101; Mon, 19 Feb 2024 09:08:45 +0530 (IST) From: Raag Jadav To: u.kleine-koenig@pengutronix.de, jarkko.nikula@linux.intel.com, mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com, lakshmi.sowjanya.d@intel.com Cc: linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org, Raag Jadav Subject: [PATCH v4 1/4] pwm: dwc: Fix PM regression Date: Mon, 19 Feb 2024 09:08:32 +0530 Message-Id: <20240219033835.11369-2-raag.jadav@intel.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240219033835.11369-1-raag.jadav@intel.com> References: <20240219033835.11369-1-raag.jadav@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791306211709735856 X-GMAIL-MSGID: 1791306211709735856 While preparing dwc driver for devm_pwmchip_alloc() usage, commit df41cd8bbcad ("pwm: dwc: Prepare removing pwm_chip from driver data") modified ->suspend() handle to use the pwm_chip as driver_data for accessing struct dwc_pwm, but didn't modify ->resume() handle with relevant changes. This results into illegal memory access during device wakeup and causes a PM regression. Fix this by correctly accessing struct dwc_pwm in ->resume() handle. Fixes: df41cd8bbcad ("pwm: dwc: Prepare removing pwm_chip from driver data") Signed-off-by: Raag Jadav --- drivers/pwm/pwm-dwc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pwm/pwm-dwc.c b/drivers/pwm/pwm-dwc.c index 8ca1c20a6aaf..c0e586688e57 100644 --- a/drivers/pwm/pwm-dwc.c +++ b/drivers/pwm/pwm-dwc.c @@ -95,7 +95,8 @@ static int dwc_pwm_suspend(struct device *dev) static int dwc_pwm_resume(struct device *dev) { - struct dwc_pwm *dwc = dev_get_drvdata(dev); + struct pwm_chip *chip = dev_get_drvdata(dev); + struct dwc_pwm *dwc = to_dwc_pwm(chip); int i; for (i = 0; i < DWC_TIMERS_TOTAL; i++) { From patchwork Mon Feb 19 03:38:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raag Jadav X-Patchwork-Id: 202914 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1124112dyc; Sun, 18 Feb 2024 23:15:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXBwhKtD6ZMe4NNLT76bizQNUoxvjRt7kxmu5lJV/x9iH9eAgHY3KK9LTQocXeHjTTEsDyY+SGKJ9FETWhdl5ayL0Fz8A== X-Google-Smtp-Source: AGHT+IHD82eplPf64McC3Qy0VtUrT42psd/AfG8X21r64su9IGxWyXr4k8MwavtJ2crwsUteMd+r X-Received: by 2002:a05:6902:250a:b0:dcd:3d6:68ad with SMTP id dt10-20020a056902250a00b00dcd03d668admr13581178ybb.0.1708326921023; Sun, 18 Feb 2024 23:15:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708326921; cv=pass; d=google.com; s=arc-20160816; b=pzMDrnddA7c0VQsuEVdNlf2isGhNvXufUbxukTDShHviVmpyILaC1+lQInWCxnLxzq L1N5Vc6xXr7YtA6pZDgDqMmOQiMTnASRfqOakyIZbl6lDqPGsOQHm03BuXkfc4sx+RAn 5SlAIKt/eeKuIJrUyUJwzw3GKE5joPmMp/tlmHYHJjqlos5v48ARErsN9EVdD1prjYc1 HHgAD7FwHZaJNEGmyTORUJ7fjm8dpxIGi3FEQqTfSLQOn2vf63n+WjK3C1b21w/0hoKo jQujBf7BS0SYParaWZBZB9lM0uyDSQgTzFFThEknLeYuSf5I+MX1jWvWnn/CpAnLuqZj zN1A== ARC-Message-Signature: i=2; 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=shXdF11uoxnCzXdxka0Uvc/20AM6LbeqGXjRLg7rsZw=; fh=y/RjPbXBoPouJTPaYxwEImQW6x8GRiLpamQFwed/jf0=; b=DMF9GB830TUeKc0lZnrGoOsRaGvxpnD72wG1q8LlbmXQcbolb0yL7CaBNAmUopuM0t uMA+6WtKfpttWm/U1SO5ajMq9Sp+ptod73zfMI8jYEjCDDFopYIbKv1WnRQSIxIU18dt xECnGumFxTpc/WLxdgoEao+Y3UIgrLwHHz95lQG2B1oJwtAaaI68GxBj/+x1KX0ofyQy YnEtpNQ08OX6bF7Dp4EDLW5LafX/+7bAzJwi1RXrv3/enGRkV1mclj8UsmKLgyDXV0LE +CLf5BukqumQzsxIpjt4r4IaNqukfJNDfQy0Th5kUhWKG1lr0YsQdi2EIWvp4UF3XWko 8uZQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=aKzljqlJ; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-70675-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70675-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id m17-20020a05620a215100b007876e8bc91dsi467137qkm.674.2024.02.18.23.15.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 23:15:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70675-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=aKzljqlJ; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-70675-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70675-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 143411C21479 for ; Mon, 19 Feb 2024 03:39:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7AB9F79E5; Mon, 19 Feb 2024 03:38:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="aKzljqlJ" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (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 2E0D84C75; Mon, 19 Feb 2024 03:38:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708313936; cv=none; b=Hz1rC99ZdrVvZmyyP/aNQF74erhbiHF08+CHJWHkbzVQZx99rSy8XLlo3c/E3sk60qHBg8QFGLSV/2pkMRBHg1zjiAItwKWzOFSYvHoJlR+gAHcVuI3rJQSLGlURBuN9a0kpY0Ec3iRnM/Hyffgdo5/Y4S5R8Se/dA1i1jQPD3k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708313936; c=relaxed/simple; bh=RIlqr5IIc2NcV+R4QbrZ4SeTtXAfOYhjo+jbzFUSD3o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Et7QhdS9ubzWRqfEwynEeTRtQJFmRhc60h+RsJB7i8rD+In9YuAtPz9pTac2xxR2PzqwCJSWAsfOu/M8G8KzKFirRJC4/vm34LM0dNKM2+IQ8sVNEjL2S9ktl1VpGF+xsuvmDZo5fFJOJqMhT1om1pfD/HQq+W6jhLLkz9xpmb8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=none smtp.mailfrom=ecsmtp.iind.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=aKzljqlJ; arc=none smtp.client-ip=198.175.65.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ecsmtp.iind.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708313935; x=1739849935; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RIlqr5IIc2NcV+R4QbrZ4SeTtXAfOYhjo+jbzFUSD3o=; b=aKzljqlJeRDBAEmSHE/MnO6HUXmaKvMbpuC128fAQhQaRYP8iEC5iAGv xFSDZ8z9b8eUPthtuvqst7kBtFN5TfnOS8KJEMRHrOWM+27DFlUhQWzVm xhwzLrRO3VvkTkz4t760RAX79lDd+VKehDUVLM+yFjRlT8igSYikjVCrA 0dM7ffQP0+vG+m90gmpGQDASKhVzcFC/NqeSKYB8GpaBMpK6IVCfSpIox AhJ6wB2mrmT3fI9KTZfP/AM6bKfNWrh6oFBlXPSM2yMGbGvGxiQ0rG80w SoSmzTgwjo29rSoXKO3CSXwVifC1lpkwnfOoqJLLj61JmgvhbhlrlEr9p Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10988"; a="24838171" X-IronPort-AV: E=Sophos;i="6.06,170,1705392000"; d="scan'208";a="24838171" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Feb 2024 19:38:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,170,1705392000"; d="scan'208";a="4281846" Received: from inesxmail01.iind.intel.com ([10.223.57.40]) by fmviesa007.fm.intel.com with ESMTP; 18 Feb 2024 19:38:47 -0800 Received: from inlubt0316.iind.intel.com (inlubt0316.iind.intel.com [10.191.20.213]) by inesxmail01.iind.intel.com (Postfix) with ESMTP id C76AA72ADC; Mon, 19 Feb 2024 09:08:45 +0530 (IST) Received: by inlubt0316.iind.intel.com (Postfix, from userid 12101951) id C30251600102; Mon, 19 Feb 2024 09:08:45 +0530 (IST) From: Raag Jadav To: u.kleine-koenig@pengutronix.de, jarkko.nikula@linux.intel.com, mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com, lakshmi.sowjanya.d@intel.com Cc: linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org, Raag Jadav Subject: [PATCH v4 2/4] pwm: dwc: drop redundant error check Date: Mon, 19 Feb 2024 09:08:33 +0530 Message-Id: <20240219033835.11369-3-raag.jadav@intel.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240219033835.11369-1-raag.jadav@intel.com> References: <20240219033835.11369-1-raag.jadav@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791310373024956856 X-GMAIL-MSGID: 1791310609502424382 pcim_iomap_table() fails only if pcim_iomap_regions() fails. No need to check for failure if the latter is already successful. Suggested-by: Andy Shevchenko Signed-off-by: Raag Jadav Tested-by: Jarkko Nikula --- drivers/pwm/pwm-dwc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/pwm/pwm-dwc.c b/drivers/pwm/pwm-dwc.c index c0e586688e57..7dbb72c80ef5 100644 --- a/drivers/pwm/pwm-dwc.c +++ b/drivers/pwm/pwm-dwc.c @@ -51,11 +51,8 @@ static int dwc_pwm_probe(struct pci_dev *pci, const struct pci_device_id *id) return ret; } + /* No need to check for failure, pcim_iomap_regions() does it for us. */ dwc->base = pcim_iomap_table(pci)[0]; - if (!dwc->base) { - dev_err(dev, "Base address missing\n"); - return -ENOMEM; - } ret = devm_pwmchip_add(dev, chip); if (ret) From patchwork Mon Feb 19 03:38:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raag Jadav X-Patchwork-Id: 202897 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1083429dyc; Sun, 18 Feb 2024 20:55:41 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVc+lF1NzckuwuNHRCpR9ydrRT5jj+kNGYYqVAx0iJ3qQnmc/G++kgInf2SdFw04fjcpaHvKVoE5oBvW2fcmNV88pdU8g== X-Google-Smtp-Source: AGHT+IE3zSnfi31UmVMyUtL62NHmha//QRGK9HxJ6hX0RNh6yQ+SQjk/zpVWaWo23XvHf2T/qpQw X-Received: by 2002:a05:6102:5487:b0:470:58b5:26ef with SMTP id bk7-20020a056102548700b0047058b526efmr588369vsb.20.1708318540940; Sun, 18 Feb 2024 20:55:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708318540; cv=pass; d=google.com; s=arc-20160816; b=YKeg98Pc5Lxrq1sxhrU23VvlZYZwnjcrCKihYUxFfJpxS/Dl+yHVWMPd2KFUTQFO6R g2Wg7qUpc5Bq4TJ3jZZy8w7SMy3PBD6EbbLbfrQi3h/aVwg7Rojizi1NGp0tB+/2Bpwt LsMZu1VWdfye5PXuJ6iDD70GRM7lMUacSNwPJ8zSdpB1iZKEtmNni6qB1Yrlzl4es9Du ezz5yGmj104XU1xxsQCDpVLGa7Cr40llghe7yAXP6Neg3t4K+kFleCLnk2dn/SJQD7ER wBw6tG6Y2N+RR94ZrBF1EAcxgmyphbMsMoqGw7Ao8f1i+0sZDKwxPN1vKqZI6+gH3IKH yOOg== ARC-Message-Signature: i=2; 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=HKWVODDyjp0edQdAuWOErLs2rH5uGlJu3rmLuCt6ufg=; fh=y/RjPbXBoPouJTPaYxwEImQW6x8GRiLpamQFwed/jf0=; b=SByHFo1qfHoOKTSA3fUNGLg3dxvqiPUcIpuusez2vMPc4NakZ3b13XTsY7gFPc/iF+ dPqOHGP98myfmC9YFSZ8M3GzjIJs4N3f6oRvOiIBtOfzcZRD9LDk1ZRGPRAzTcRFQl4N ZVL6M3Ct2mcEFKJcmToCczqcxCLt+SYxaBsUc4JG2w/8FlcfI5uhydS5kgS8Qgt93/wZ cXjpZOPrZaKqsjjg9ZRzFeFutWN4CXFI34zulfk9KTb7SUThoQlbRXHa9QAvgEbhqvZR GvS8My6uqwBKGyavzooJT5yW6IP8kUYlSK0iu1d1LwQvCd7jx0EW/mv79zpfprv5Mfko nNqQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=HcATlxWC; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-70678-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70678-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id w14-20020a05622a190e00b0042e16147690si626843qtc.683.2024.02.18.20.55.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 20:55:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70678-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=HcATlxWC; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-70678-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70678-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C6D2E1C21816 for ; Mon, 19 Feb 2024 03:39:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 886B61B7EE; Mon, 19 Feb 2024 03:39:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="HcATlxWC" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (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 592065394; Mon, 19 Feb 2024 03:38:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708313939; cv=none; b=SrkWssxSARvYbr1kp923z+X4HxfmVBlxpWAkU/mo/LWNwlNWz4sSSWpfK2yvaz/vQLFQ1gLnrgmnp/pv3VDpBM1j2qbSMfpXK8z7A2w/C9pj/IjjIVhZSvoWgmuFbGgTXGMd66Aeb7rocRgtzs9fSsEGd1Dqqa79tfzcoVpKgK0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708313939; c=relaxed/simple; bh=3SA399l3wQi0zEkfAPZlEB2CaZPgZiYLUGDzOWweojA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lzGEEGecuf3mCVeDxBuawBLYQss/n5bIUzKHYKAcAY4uHLitGR5GUS1728GzL5qoTGzRN7etYiM9USA1QdP7x4rTyDoIWcZW2toSKgOXA9ZSX/6TYmlNzruCzH8FWUjIkRXnliudUFgeg8Nqc6ePLNGust8gHkUjLLaFzlPQULg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=none smtp.mailfrom=ecsmtp.iind.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=HcATlxWC; arc=none smtp.client-ip=198.175.65.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ecsmtp.iind.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708313938; x=1739849938; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3SA399l3wQi0zEkfAPZlEB2CaZPgZiYLUGDzOWweojA=; b=HcATlxWCYcLFsVDNLKZdcVNGRFEDaEwPb2xUOt5cnQxRAFUMKYwU++cE QxUmJqM0Fk9MSzeWxr+jOed9N8Jb+TIhbGcuzETb96RGeCz58MthvyVgS JoaSqZ9TzzWpy8sRfeVZm3D63tzctldLni7dzg7OuDWxtEdzldsFOVxyP mX/e/bXtHq3lThmGjDtQlKLZJcHbSu8B9umgM17cU13jdt0Ki96lrsdl5 lWRvlGY+R+SuUbAh72dfDZnJATXFQuGHKPSxZsnH3Y2vb0spB/PlMAbS6 raN6Mf8Lzqfkpl69PjGGlMRPtPQaIdFBDi0QK01+kEmAL/riLdM0d8VNy A==; X-IronPort-AV: E=McAfee;i="6600,9927,10988"; a="24838177" X-IronPort-AV: E=Sophos;i="6.06,170,1705392000"; d="scan'208";a="24838177" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Feb 2024 19:38:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,170,1705392000"; d="scan'208";a="4281841" Received: from inesxmail01.iind.intel.com ([10.223.57.40]) by fmviesa007.fm.intel.com with ESMTP; 18 Feb 2024 19:38:47 -0800 Received: from inlubt0316.iind.intel.com (inlubt0316.iind.intel.com [10.191.20.213]) by inesxmail01.iind.intel.com (Postfix) with ESMTP id C771672DD8; Mon, 19 Feb 2024 09:08:45 +0530 (IST) Received: by inlubt0316.iind.intel.com (Postfix, from userid 12101951) id C34251600103; Mon, 19 Feb 2024 09:08:45 +0530 (IST) From: Raag Jadav To: u.kleine-koenig@pengutronix.de, jarkko.nikula@linux.intel.com, mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com, lakshmi.sowjanya.d@intel.com Cc: linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org, Raag Jadav Subject: [PATCH v4 3/4] pwm: dwc: Add 16 channel support for Intel Elkhart Lake Date: Mon, 19 Feb 2024 09:08:34 +0530 Message-Id: <20240219033835.11369-4-raag.jadav@intel.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240219033835.11369-1-raag.jadav@intel.com> References: <20240219033835.11369-1-raag.jadav@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791301822344426029 X-GMAIL-MSGID: 1791301822344426029 Intel Elkhart Lake PSE includes two instances of PWM as a single PCI function with 8 channels each. Add support for the remaining channels. Signed-off-by: Raag Jadav Tested-by: Jarkko Nikula Tested-by: Lakshmi Sowjanya D --- drivers/pwm/pwm-dwc.c | 38 +++++++++++++++++++++++++++++--------- drivers/pwm/pwm-dwc.h | 5 +++++ 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/drivers/pwm/pwm-dwc.c b/drivers/pwm/pwm-dwc.c index 7dbb72c80ef5..de95352081fa 100644 --- a/drivers/pwm/pwm-dwc.c +++ b/drivers/pwm/pwm-dwc.c @@ -25,17 +25,32 @@ #include "pwm-dwc.h" -static int dwc_pwm_probe(struct pci_dev *pci, const struct pci_device_id *id) +/* Elkhart Lake */ +static const struct dwc_pwm_info ehl_pwm_info = { + .nr = 2, + .size = 0x1000, +}; + +static int dwc_pwm_init_one(struct device *dev, void __iomem *base, unsigned int offset) { - struct device *dev = &pci->dev; struct pwm_chip *chip; struct dwc_pwm *dwc; - int ret; chip = dwc_pwm_alloc(dev); if (IS_ERR(chip)) return PTR_ERR(chip); + dwc = to_dwc_pwm(chip); + dwc->base = base + offset; + + return devm_pwmchip_add(dev, chip); +} + +static int dwc_pwm_probe(struct pci_dev *pci, const struct pci_device_id *id) +{ + const struct dwc_pwm_info *info; + struct device *dev = &pci->dev; + int i, ret; ret = pcim_enable_device(pci); if (ret) { @@ -51,12 +66,17 @@ static int dwc_pwm_probe(struct pci_dev *pci, const struct pci_device_id *id) return ret; } - /* No need to check for failure, pcim_iomap_regions() does it for us. */ - dwc->base = pcim_iomap_table(pci)[0]; + info = (const struct dwc_pwm_info *)id->driver_data; - ret = devm_pwmchip_add(dev, chip); - if (ret) - return ret; + for (i = 0; i < info->nr; i++) { + /* + * No need to check for pcim_iomap_table() failure, + * pcim_iomap_regions() already does it for us. + */ + ret = dwc_pwm_init_one(dev, pcim_iomap_table(pci)[0], i * info->size); + if (ret) + return ret; + } pm_runtime_put(dev); pm_runtime_allow(dev); @@ -108,7 +128,7 @@ static int dwc_pwm_resume(struct device *dev) static DEFINE_SIMPLE_DEV_PM_OPS(dwc_pwm_pm_ops, dwc_pwm_suspend, dwc_pwm_resume); static const struct pci_device_id dwc_pwm_id_table[] = { - { PCI_VDEVICE(INTEL, 0x4bb7) }, /* Elkhart Lake */ + { PCI_VDEVICE(INTEL, 0x4bb7), (kernel_ulong_t)&ehl_pwm_info }, { } /* Terminating Entry */ }; MODULE_DEVICE_TABLE(pci, dwc_pwm_id_table); diff --git a/drivers/pwm/pwm-dwc.h b/drivers/pwm/pwm-dwc.h index 5887371803fd..a8b074841ae8 100644 --- a/drivers/pwm/pwm-dwc.h +++ b/drivers/pwm/pwm-dwc.h @@ -33,6 +33,11 @@ MODULE_IMPORT_NS(dwc_pwm); #define DWC_TIM_CTRL_INT_MASK BIT(2) #define DWC_TIM_CTRL_PWM BIT(3) +struct dwc_pwm_info { + unsigned int nr; + unsigned int size; +}; + struct dwc_pwm_ctx { u32 cnt; u32 cnt2; From patchwork Mon Feb 19 03:38:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raag Jadav X-Patchwork-Id: 202911 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1114192dyc; Sun, 18 Feb 2024 22:44:57 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV/S/p4QYCeq5/5KqA9vj38vd2zXQLpcyFi5xKMxfcJfCapuCgAoM5rC44VrX+9IWo+FvYmCRWpXDRvnrONTduDb9am0A== X-Google-Smtp-Source: AGHT+IG4OHSkey9TJxv5zCTg1SGVIoKWcXhvVhBVJ8B2L7+1c9BWBSPPnrzR4yUl9bXozW1GAd4L X-Received: by 2002:a17:90a:bb8b:b0:299:54bb:5cac with SMTP id v11-20020a17090abb8b00b0029954bb5cacmr4077860pjr.11.1708325097385; Sun, 18 Feb 2024 22:44:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708325097; cv=pass; d=google.com; s=arc-20160816; b=Bu0Hy70SFrSVu7C4aoOovPg230i2xfhWZ/Rx5BamrLZmIII1BZoJqk7UYAbb2S/5IB K1OlEVxJmgQrsJ24txQF+hhMi98y5cvtc6JLyXkungYVX6IuRbkP/T2Hnyd2K58/96Py bDgwPSmXBLdvdQDx4siNU6GcsC3Gb81/C6ky6ru/63HuQ9uh4ramJoE+q53fCDHKLM7m 3Gu/A61gTuuplb4KywabTczuFqfIAl0GQWL7QNXGvqVW81/On44wPza48hBhIxBy0Ws5 hO8Xqnuimc8tKAg9A6lh/cJUutrad17FF7jaa/hq7thDhJVQrMFA/hmGgreBZSkIQQ2o bGtA== ARC-Message-Signature: i=2; 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=sj1RslH3nTcJN2lIF4nen+uL5UwvvxY01aUsU9TTwJ4=; fh=y/RjPbXBoPouJTPaYxwEImQW6x8GRiLpamQFwed/jf0=; b=vla9njdsolVCtBMj98WQ4CvNp2Dgi0kzkcQRKYq8gt7E82v0gMphJAN+0CYwIyNnRE zeJnpgkY0+pNKqRVoqP2dgy3j6ApA/KmWERngmoUQHT7XVr/4EAL7ubqW/fKqckufzgQ P9GLTrfwyGaNCMuzWrDAdBww4O0ZuHOtg9Hq9dvwBBrY6YGNZ9/fFlo07NXLVTXc16D7 gUnhv4Fg5UY13IQYz0tpzYWYmeGVBfyb1at6BPdYcCvZrO3b20FFbd+gUlD1CQW6aYBc 1a2muBIkv2hxcCUElPk29tb/ii+RVtzO9xG+BBjyWfX0zAvYOMUTxFmMXXfHjWyA1g/g aX1A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TNi0CWEk; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-70679-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70679-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 4-20020a17090a098400b00298e649da8csi4062775pjo.135.2024.02.18.22.44.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 22:44:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70679-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TNi0CWEk; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-70679-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70679-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 9CDB6280DBD for ; Mon, 19 Feb 2024 03:39:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B647D1B811; Mon, 19 Feb 2024 03:39:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="TNi0CWEk" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (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 B8DE5567A; Mon, 19 Feb 2024 03:38:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708313940; cv=none; b=se9K3nmXuTr3rlmSNrwz6YgLKNEzSpvwPGjzDL25fX0HqVEkFxx9meINx9L9MQIHJLsjOAyz2/f74gqwtGbwHse7/imLKXkjFEqlNJtVGFIlg2YUHVJRo9Rz866ZM8pCmGradVBZfDVgOz/37TyavuNgUTfjs2m2Ze1DoQkoqKo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708313940; c=relaxed/simple; bh=KW3Rg0hKJSlekLEkpQDUS0ofXFzF55PYH45WySuASc8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=t/XONEwqP9oQm6qkSxAuS2cdwpY1ihLjkHSGWz/kZYujjTeqz7CRVetPGw7XrJvakzF0xPulA1fxpzVIKtH297pzOL3NL9JrpCLYxVnoOy9wUbDDC2pOiuWR0NFXYzffdgV0x9/WTiVrBNNKgn4H4tcWy9krs4CcvzME7CYLAkI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=none smtp.mailfrom=ecsmtp.iind.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=TNi0CWEk; arc=none smtp.client-ip=198.175.65.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ecsmtp.iind.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708313939; x=1739849939; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KW3Rg0hKJSlekLEkpQDUS0ofXFzF55PYH45WySuASc8=; b=TNi0CWEk6xm+S+41ucxbmeNGFts0WZK62fFQ6RrlppT2/xV4saVm9LPP BTm+By3Iv0qMqy2R2Uti99j7pJ3x1mWAmJA2IdmdodeklGlmiU/GxWE/0 PeF5Gpe9xSMCEisD9yN3CtENJrFLEfa1/K1OZcZzkHKERdKh5tQlBbcZi Zwnbzh/fb28GC3k4g9dICI+yP68AR9icc92vvsgyl7pIstzFYuP/dG4S1 DjGLzZWy7jkJRn1ZX53zrpX3oosywpG864yr76sqrd8i47E9UFoO3iIRx EEwmnMfyWQgyHiZpso++oV38SnetccTV/1qiRo10Fso8+Naj7hOoIM8VX Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10988"; a="24838178" X-IronPort-AV: E=Sophos;i="6.06,170,1705392000"; d="scan'208";a="24838178" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Feb 2024 19:38:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,170,1705392000"; d="scan'208";a="4281850" Received: from inesxmail01.iind.intel.com ([10.223.57.40]) by fmviesa007.fm.intel.com with ESMTP; 18 Feb 2024 19:38:47 -0800 Received: from inlubt0316.iind.intel.com (inlubt0316.iind.intel.com [10.191.20.213]) by inesxmail01.iind.intel.com (Postfix) with ESMTP id C89BF72DF7; Mon, 19 Feb 2024 09:08:45 +0530 (IST) Received: by inlubt0316.iind.intel.com (Postfix, from userid 12101951) id C387A1600104; Mon, 19 Feb 2024 09:08:45 +0530 (IST) From: Raag Jadav To: u.kleine-koenig@pengutronix.de, jarkko.nikula@linux.intel.com, mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com, lakshmi.sowjanya.d@intel.com Cc: linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org, Raag Jadav Subject: [PATCH v4 4/4] pwm: dwc: simplify error handling Date: Mon, 19 Feb 2024 09:08:35 +0530 Message-Id: <20240219033835.11369-5-raag.jadav@intel.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240219033835.11369-1-raag.jadav@intel.com> References: <20240219033835.11369-1-raag.jadav@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791308697386745824 X-GMAIL-MSGID: 1791308697386745824 Simplify error handling in ->probe() function using dev_err_probe() helper and while at it, drop error codes from the message to prevent duplication. Signed-off-by: Raag Jadav Tested-by: Jarkko Nikula --- drivers/pwm/pwm-dwc.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/pwm/pwm-dwc.c b/drivers/pwm/pwm-dwc.c index de95352081fa..676eaf8d7a53 100644 --- a/drivers/pwm/pwm-dwc.c +++ b/drivers/pwm/pwm-dwc.c @@ -53,18 +53,14 @@ static int dwc_pwm_probe(struct pci_dev *pci, const struct pci_device_id *id) int i, ret; ret = pcim_enable_device(pci); - if (ret) { - dev_err(dev, "Failed to enable device (%pe)\n", ERR_PTR(ret)); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "Failed to enable device\n"); pci_set_master(pci); ret = pcim_iomap_regions(pci, BIT(0), pci_name(pci)); - if (ret) { - dev_err(dev, "Failed to iomap PCI BAR (%pe)\n", ERR_PTR(ret)); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "Failed to iomap PCI BAR\n"); info = (const struct dwc_pwm_info *)id->driver_data;