Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2223411/?format=api
{ "id": 2223411, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2223411/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pwm/patch/20260415093433.2359955-1-sangyun.kim@snu.ac.kr/", "project": { "id": 38, "url": "http://patchwork.ozlabs.org/api/1.1/projects/38/?format=api", "name": "Linux PWM development", "link_name": "linux-pwm", "list_id": "linux-pwm.vger.kernel.org", "list_email": "linux-pwm@vger.kernel.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20260415093433.2359955-1-sangyun.kim@snu.ac.kr>", "date": "2026-04-15T09:34:33", "name": "pwm: atmel-tcb: Fix sleeping function called from invalid context", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "14287fff69fabca2d5b4e3d4c17c6f17cc44f26b", "submitter": { "id": 93159, "url": "http://patchwork.ozlabs.org/api/1.1/people/93159/?format=api", "name": "Sangyun Kim", "email": "sangyun.kim@snu.ac.kr" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-pwm/patch/20260415093433.2359955-1-sangyun.kim@snu.ac.kr/mbox/", "series": [ { "id": 499949, "url": "http://patchwork.ozlabs.org/api/1.1/series/499949/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pwm/list/?series=499949", "date": "2026-04-15T09:34:33", "name": "pwm: atmel-tcb: Fix sleeping function called from invalid context", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/499949/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2223411/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2223411/checks/", "tags": {}, "headers": { "Return-Path": "\n <linux-pwm+bounces-8582-incoming=patchwork.ozlabs.org@vger.kernel.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-pwm@vger.kernel.org" ], "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=snu.ac.kr header.i=@snu.ac.kr header.a=rsa-sha256\n header.s=google header.b=lpHlEmA7;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-pwm+bounces-8582-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=snu.ac.kr header.i=@snu.ac.kr\n header.b=\"lpHlEmA7\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.214.174", "smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=snu.ac.kr", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=snu.ac.kr" ], "Received": [ "from tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fwbbR5Yz4z1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 15 Apr 2026 19:35:15 +1000 (AEST)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id DB11F3012CE9\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 15 Apr 2026 09:34:54 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 4CC2131B80E;\n\tWed, 15 Apr 2026 09:34:53 +0000 (UTC)", "from mail-pl1-f174.google.com (mail-pl1-f174.google.com\n [209.85.214.174])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 0938C33A71B\n\tfor <linux-pwm@vger.kernel.org>; Wed, 15 Apr 2026 09:34:48 +0000 (UTC)", "by mail-pl1-f174.google.com with SMTP id\n d9443c01a7336-2ad9a9be502so40088645ad.0\n for <linux-pwm@vger.kernel.org>; Wed, 15 Apr 2026 02:34:48 -0700 (PDT)", "from nunu.. (nunu.snu.ac.kr. [147.46.112.82])\n by smtp.gmail.com with ESMTPSA id\n d9443c01a7336-2b47826e1b7sm15311575ad.49.2026.04.15.02.34.45\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 15 Apr 2026 02:34:47 -0700 (PDT)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776245693; cv=none;\n b=Cm2Y+topP4yjVLv+JSVEMYnp5FBLhq65CNdpXzda7IFA9ILV9ukBCvWW0/DKjqVOe3vMHKY0ckW0fewOZrHm94tI7KWU+1JcREUXda5PoTYryBf7dJ+3F85ZCPNmsS5q3RjnmHVW7tb2tfaTNxOJcn9vv6JKd5v2x2bRIFYG4pw=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776245693; c=relaxed/simple;\n\tbh=jVmeTwzk9PJAUrS4SAHiGQddsG+3lg47R5zNpb3K/Rg=;\n\th=From:To:Cc:Subject:Date:Message-Id:MIME-Version;\n b=iHsEcvXYGf7ZOAup/GouUYLCPFd5ENRyVvVlA1v32gCZatdeKWR4nG5aOVEjb/ejoThVmqy37s3dFbKp9bYd148d/j5rr65rCoQ31ja4gFNEks3paPiTD9Ix+Vd8Ls78XdbYz4O4D1W/Nt8blQOEVKoLZqwvaF1OYITgobxScN0=", "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=snu.ac.kr;\n spf=pass smtp.mailfrom=snu.ac.kr;\n dkim=pass (1024-bit key) header.d=snu.ac.kr header.i=@snu.ac.kr\n header.b=lpHlEmA7; arc=none smtp.client-ip=209.85.214.174", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=snu.ac.kr; s=google; t=1776245688; x=1776850488;\n darn=vger.kernel.org;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:from:to:cc:subject:date:message-id:reply-to;\n bh=b3b8a9yRsPwuBMnRE7k+9xNpDjqVfRCXwrD7bmNetW0=;\n b=lpHlEmA7YmA1epbGH1jUegZ0n+QtskT70HqAu8QGrffpuFldfQUXkjAHQPl9O8pMsS\n o7ikp5TCm/Dw65Kur990XAr0Sib6svkgm2H7NZfZMIggIL2Am/m1NJ/SqknCVVDzBvUz\n nrofrnlaDjXQN1p4j4TGJ3Dfcj4Fs2FR0So0E=", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776245688; x=1776850488;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=b3b8a9yRsPwuBMnRE7k+9xNpDjqVfRCXwrD7bmNetW0=;\n b=p6ia2fpma261ffjdMFA6+zbLJ+qRPHb0IhxtBxBvj/ZAfEXnq6zbnhyelTb1h/uGjc\n 1qqH/rT0BFW60bsWFAEYMxHvP0Sc3x4AxTWCk1Ti4FDvCpGIQwcWDQAXmSxDmhqI+dVQ\n cSlyMm4NzF9lByD14xIwyYRmznfeOJapLLn4CBS4y4bKjtzBElYugA/5vJDWDr4ocmz9\n TRFBPQDUQqoGdWIJANxMt3Yu/7f7oVrMBh7zlrBc8j0eHOb9HykIMF9VLgkcbIz5eETp\n JUpSnDQ9qx1N/yrkQvkPyMHBEARzLSuPUFoJCZOfJKf7jef9tNvRYQBuwA2A7pIDFNRq\n Px3A==", "X-Forwarded-Encrypted": "i=1;\n AFNElJ+s08dwIMhjAOmUGAjPaTQDVVupJDdkTCOTir4ERqAy4cgZpkadc69kOTTj+RVbEPHIQxkVL+ZYeJU=@vger.kernel.org", "X-Gm-Message-State": "AOJu0YzZkPPpzDhCU/9na9WCU9eRuoV3/Ltr5TrIUavfP2m9gCtZpTot\n\tswQMQI9F8HWpjFRRTyTG/lKgy7e4BKascKGkynrG2p0nPPilFjl4V8toPvbjE0KIyt4=", "X-Gm-Gg": "AeBDievX4mhaLW7DHoRlb/mPdD6lNEyyxGDsgpWnSZZZ5Unv5NuKQjtKnf8dXJorDx/\n\tPgZXZ9YeD69i14z/n8NCGINLaFDM7wqXpIznuXC+AoKll2qFN6TLI4UbKdjdqQhRs82VF1YMUQF\n\ta4MKuW/UOfEgcLlxLkJqg6w4KlFXvL3F5I/UXeGel6lXKFhjQa9IYMgKkd7ojFJmRkNEfZCipVb\n\tlr03E+0qHCOwN+6eELdcaJqM1AR8PN1d+wPNdwEjfjg0BN9sQTnJRhYZpRYg8k6/lHQIypTRhUM\n\t4/63I1p+NImmJDY8GkpRYBHmJitAB2pPuJxl6QdRiZemBveMIfPChS9QE906dNsbVfDGf1MRyh7\n\tMp07aTnSq6c+GTSh6uQnEcyQBWDrvtB3qPJ+13IIggAimYPtJuAPUaAW2q4FTCU07mM0qirJBWd\n\tcp7cCYlaaF3mB5cf4Y0712c9D8X9fLaGXIdG3r1l2/tzIYy+sufkesfC3HUsAAxed1yZgZPaWTk\n\tScme/rH", "X-Received": "by 2002:a17:902:d507:b0:2b4:5cd0:b6c3 with SMTP id\n d9443c01a7336-2b45cd0bb63mr148252015ad.29.1776245688376;\n Wed, 15 Apr 2026 02:34:48 -0700 (PDT)", "From": "Sangyun Kim <sangyun.kim@snu.ac.kr>", "To": "ukleinek@kernel.org", "Cc": "nicolas.ferre@microchip.com,\n\talexandre.belloni@bootlin.com,\n\tclaudiu.beznea@tuxon.dev,\n\tlinux-pwm@vger.kernel.org,\n\tlinux-arm-kernel@lists.infradead.org,\n\tlinux-kernel@vger.kernel.org", "Subject": "[PATCH] pwm: atmel-tcb: Fix sleeping function called from invalid\n context", "Date": "Wed, 15 Apr 2026 18:34:33 +0900", "Message-Id": "<20260415093433.2359955-1-sangyun.kim@snu.ac.kr>", "X-Mailer": "git-send-email 2.34.1", "Precedence": "bulk", "X-Mailing-List": "linux-pwm@vger.kernel.org", "List-Id": "<linux-pwm.vger.kernel.org>", "List-Subscribe": "<mailto:linux-pwm+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-pwm+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit" }, "content": "atmel_tcb_pwm_apply() holds tcbpwmc->lock as a spinlock via\nguard(spinlock)() and then calls atmel_tcb_pwm_config(), which calls\nclk_get_rate() twice. clk_get_rate() acquires clk_prepare_lock (a\nmutex), so this is a sleep-in-atomic-context violation.\n\nOn CONFIG_DEBUG_ATOMIC_SLEEP kernels every pwm_apply_state() that\nenables or reconfigures the PWM triggers a \"BUG: sleeping function\ncalled from invalid context\" warning.\n\nAll callers of tcbpwmc->lock (the .request and .apply callbacks) run in\nprocess context and only need mutual exclusion against each other, so\nuse a mutex instead of a spinlock and allow the sleeping calls inside\natmel_tcb_pwm_config().\n\nFixes: 37f7707077f5 (\"pwm: atmel-tcb: Fix race condition and convert to guards\")\nSigned-off-by: Sangyun Kim <sangyun.kim@snu.ac.kr>\n---\n drivers/pwm/pwm-atmel-tcb.c | 9 +++++----\n 1 file changed, 5 insertions(+), 4 deletions(-)", "diff": "diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c\nindex f9ff78ba122d..6405e82d9f10 100644\n--- a/drivers/pwm/pwm-atmel-tcb.c\n+++ b/drivers/pwm/pwm-atmel-tcb.c\n@@ -17,6 +17,7 @@\n #include <linux/ioport.h>\n #include <linux/io.h>\n #include <linux/mfd/syscon.h>\n+#include <linux/mutex.h>\n #include <linux/platform_device.h>\n #include <linux/pwm.h>\n #include <linux/of.h>\n@@ -47,7 +48,7 @@ struct atmel_tcb_channel {\n };\n \n struct atmel_tcb_pwm_chip {\n-\tspinlock_t lock;\n+\tstruct mutex lock;\n \tu8 channel;\n \tu8 width;\n \tstruct regmap *regmap;\n@@ -81,7 +82,7 @@ static int atmel_tcb_pwm_request(struct pwm_chip *chip,\n \ttcbpwm->period = 0;\n \ttcbpwm->div = 0;\n \n-\tguard(spinlock)(&tcbpwmc->lock);\n+\tguard(mutex)(&tcbpwmc->lock);\n \n \tregmap_read(tcbpwmc->regmap, ATMEL_TC_REG(tcbpwmc->channel, CMR), &cmr);\n \t/*\n@@ -335,7 +336,7 @@ static int atmel_tcb_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,\n \tint duty_cycle, period;\n \tint ret;\n \n-\tguard(spinlock)(&tcbpwmc->lock);\n+\tguard(mutex)(&tcbpwmc->lock);\n \n \tif (!state->enabled) {\n \t\tatmel_tcb_pwm_disable(chip, pwm, state->polarity);\n@@ -438,7 +439,7 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)\n \tif (err)\n \t\tgoto err_gclk;\n \n-\tspin_lock_init(&tcbpwmc->lock);\n+\tmutex_init(&tcbpwmc->lock);\n \n \terr = pwmchip_add(chip);\n \tif (err < 0)\n", "prefixes": [] }