get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2224872/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2224872,
    "url": "http://patchwork.ozlabs.org/api/patches/2224872/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-pwm/patch/20260419080838.3192357-1-sangyun.kim@snu.ac.kr/",
    "project": {
        "id": 38,
        "url": "http://patchwork.ozlabs.org/api/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": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260419080838.3192357-1-sangyun.kim@snu.ac.kr>",
    "list_archive_url": null,
    "date": "2026-04-19T08:08:38",
    "name": "[v2] pwm: atmel-tcb: Cache clock rates and mark chip as atomic",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "a6f522f7870eb22e203a3e0a8fd107a3a6432edd",
    "submitter": {
        "id": 93159,
        "url": "http://patchwork.ozlabs.org/api/people/93159/?format=api",
        "name": "Sangyun Kim",
        "email": "sangyun.kim@snu.ac.kr"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-pwm/patch/20260419080838.3192357-1-sangyun.kim@snu.ac.kr/mbox/",
    "series": [
        {
            "id": 500485,
            "url": "http://patchwork.ozlabs.org/api/series/500485/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-pwm/list/?series=500485",
            "date": "2026-04-19T08:08:38",
            "name": "[v2] pwm: atmel-tcb: Cache clock rates and mark chip as atomic",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/500485/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2224872/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2224872/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <linux-pwm+bounces-8632-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=jNa41cP5;\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-8632-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=\"jNa41cP5\"",
            "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.215.176",
            "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 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fz1V40ml5z1yD4\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 19 Apr 2026 18:08:59 +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 4B0FE3016494\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 19 Apr 2026 08:08:56 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 452FE33CEA8;\n\tSun, 19 Apr 2026 08:08:53 +0000 (UTC)",
            "from mail-pg1-f176.google.com (mail-pg1-f176.google.com\n [209.85.215.176])\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 34BE930F53C\n\tfor <linux-pwm@vger.kernel.org>; Sun, 19 Apr 2026 08:08:49 +0000 (UTC)",
            "by mail-pg1-f176.google.com with SMTP id\n 41be03b00d2f7-c7973bbc16dso1385261a12.0\n        for <linux-pwm@vger.kernel.org>; Sun, 19 Apr 2026 01:08:49 -0700 (PDT)",
            "from nunu.. (nunu.snu.ac.kr. [147.46.112.82])\n        by smtp.gmail.com with ESMTPSA id\n d2e1a72fcca58-82f8ebb3f31sm8583735b3a.37.2026.04.19.01.08.46\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Sun, 19 Apr 2026 01:08:48 -0700 (PDT)"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776586133; cv=none;\n b=f0cyy+/JoR3Tm8eCEk4ldMkSq9FhHCARm+hvecfFYAlMRbKqDaVdRIDaVJeEL/uXZw9Cmc4KQDFx1eU5z11mNrDyVhDRgWmB0rzKo821/4USOOaJZt2w3G/LW7xccVYJ8IzkBsfLHZreOhnoT1LRrYgMJCmSqSlJCn4WLvoog5A=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776586133; c=relaxed/simple;\n\tbh=OCi9nDDPRNt+0Tt22m27NOerlt18eeVeDVdbhOVkDFA=;\n\th=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n\t MIME-Version:Content-Type;\n b=LbFoUVuOosWtsqWqOKO24xNcFGrvp0rnMGoccwEd1oNN41gDbW/p7B6AWFo6OhOdzygLpgDGBiDwhs97MTX8jyoxf42Pv6mEQblySI5EuMcDdtqXoQMu2hKh+bfaB6r29IuUpQcDxr/YLoQ5kUAjfFlbqhPq19XQGQf8xiAMizA=",
        "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=jNa41cP5; arc=none smtp.client-ip=209.85.215.176",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=snu.ac.kr; s=google; t=1776586128; x=1777190928;\n darn=vger.kernel.org;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=xkh8bldvZTdSRdXrrl3UK2Fj0kWohJXGFNjSq2Nw4w4=;\n        b=jNa41cP57MoEmdvofah+K481ZlzR6vLBJz0my5/u3LDfngebYioiBeCprDCpq1YC9n\n         rT+bV2dUTMnJQzJJYLRVKOcEr00H8hJeMSpEDUTWvYJ2OUg5VXtDU5eJpj8JLVWsF4KW\n         0WLLj9bqOf39JvfKngcPL4DhjPwvVBHlKes30=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1776586128; x=1777190928;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n         :to:cc:subject:date:message-id:reply-to;\n        bh=xkh8bldvZTdSRdXrrl3UK2Fj0kWohJXGFNjSq2Nw4w4=;\n        b=RK4SjjC7XTOg6fx9p2EbEtU69z1/0saO6+ReQt1nXHz5bx/SnC40yBPjW5gy/M1QFx\n         8tx5ByBQmwIGZFyOP6nbp+N8FJagqli9ShVbCqB8HaUFTildnhIssm9S278fj2AvL5h8\n         L6gGKVLYo07Y1rf2nucOxsq6A2sCZ44oU4zbykj3lJQquRdt9+XDJ6fd1QPN+wnGcHMM\n         E4/OmjqGtpmik09htzFEThdCnuYwpb3E+I4NyXH+ecSb0+TMM3gN7aMdjT3e277HQfga\n         FUYn+QrCczDeougdOSqOIjzhhAOXCgqQGPcBrSLlVZLLq7aifDIHQiZkOo6LbKDaP1Ud\n         5d2g==",
        "X-Forwarded-Encrypted": "i=1;\n AFNElJ+Cgp4SjV3tAWGpEj3VF6o1r2EE2PeFal9WJYTKLcNKo9158+mJU6+9Me+KDlJaikJVwUkyzWhGZME=@vger.kernel.org",
        "X-Gm-Message-State": "AOJu0Yzn8mI6rnvS1Kx4KPTUFt4V4zK+/hFB+EJK8Yr4WiiBdhBCejPb\n\tRJKwuZ5z0f0hfW9uBILfN1GkhJLtKcy0gzE0Ek642qdkLExhG/63kyVKFFgeb2gln+I=",
        "X-Gm-Gg": "AeBDietyBbIENZDf2kToMoQJkAybIClbLI9zPdEIYWNsp+sNVJiWUA7ewgYQOI0W3P4\n\tmJXVNEqq/t48Ck/ddfaunWr1ofz05XF7J5y0rNxEwUSbps4uOwZwmhAbPMOGIxtueMA6MopbhvV\n\tt7/c9STOxX3o2rVQjePyusuxPdbKj6oyZeZiSb8UPjzymgNs1oWb36n5HK02FVgrGVX6E0A93+4\n\tSL9anUXNz9CzJSqKz56q5BjiBUAfRIaNkDQUwWGe3TxwkMrtMr6F4ODP/obFF7l9I0hYYEnOJe2\n\tFxylu0bfMOxrbtE2Q3bt18mPnRR7fSdlG+M5MHRVDOAXBN+esFDNE++ceLzt67golTHukLvuVGT\n\tCcg7oS+TVTfwf0Ae8DcOJkZ7PXHqcgVT9dEs8MpWWgdkdYQpXlrqBRdWVP6I/HsCdL6W8PkSMGg\n\tudWMK2tUKlTn5lAN7jkOifpimsUvH6dpnE9mKx5LiJNctzkxe198jUimF4P/x9HXa1EKzuQg==",
        "X-Received": "by 2002:a05:6a20:6a20:b0:39f:24ad:ad00 with SMTP id\n adf61e73a8af0-3a08d68d780mr10535341637.7.1776586128576;\n        Sun, 19 Apr 2026 01:08: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 v2] pwm: atmel-tcb: Cache clock rates and mark chip as atomic",
        "Date": "Sun, 19 Apr 2026 17:08:38 +0900",
        "Message-Id": "<20260419080838.3192357-1-sangyun.kim@snu.ac.kr>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20260415093433.2359955-1-sangyun.kim@snu.ac.kr>",
        "References": "<20260415093433.2359955-1-sangyun.kim@snu.ac.kr>",
        "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-Type": "text/plain; charset=UTF-8",
        "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\nAcquire exclusive control over the clock rates with\nclk_rate_exclusive_get() at probe time and cache the rates in struct\natmel_tcb_pwm_chip, then read the cached rates from\natmel_tcb_pwm_config(). This keeps the spinlock-based mutual exclusion\nintroduced in commit 37f7707077f5 (\"pwm: atmel-tcb: Fix race condition\nand convert to guards\") and removes the sleeping calls from the atomic\nsection.\n\nWith no sleeping calls left in .apply() and the regmap-mmio bus already\nrunning with fast_io=true, also mark the chip as atomic so consumers\ncan use pwm_apply_atomic() from atomic context.\n\nFixes: 37f7707077f5 (\"pwm: atmel-tcb: Fix race condition and convert to guards\")\nSigned-off-by: Sangyun Kim <sangyun.kim@snu.ac.kr>\n---\nHi Uwe,\n\nThanks for the review! \"Sangyun\" is the right form to address me, no\nworries.\n\nChanges in v2:\n - Keep the spinlock instead of converting tcbpwmc->lock to a mutex.\n - Cache clk and slow_clk rates at probe via clk_rate_exclusive_get()\n   so the .apply() path no longer calls clk_get_rate() under the\n   spinlock.\n - Mark the chip as atomic now that .apply() has no sleeping calls.\n\nThanks,\nSangyun\n\n drivers/pwm/pwm-atmel-tcb.c | 28 +++++++++++++++++++++++++---\n 1 file changed, 25 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c\nindex f9a9c12cbcdd..8d46ce28f736 100644\n--- a/drivers/pwm/pwm-atmel-tcb.c\n+++ b/drivers/pwm/pwm-atmel-tcb.c\n@@ -50,6 +50,8 @@ struct atmel_tcb_pwm_chip {\n \tspinlock_t lock;\n \tu8 channel;\n \tu8 width;\n+\tunsigned long rate;\n+\tunsigned long slow_rate;\n \tstruct regmap *regmap;\n \tstruct clk *clk;\n \tstruct clk *gclk;\n@@ -266,7 +268,7 @@ static int atmel_tcb_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,\n \tint slowclk = 0;\n \tunsigned period;\n \tunsigned duty;\n-\tunsigned rate = clk_get_rate(tcbpwmc->clk);\n+\tunsigned long rate = tcbpwmc->rate;\n \tunsigned long long min;\n \tunsigned long long max;\n \n@@ -294,7 +296,7 @@ static int atmel_tcb_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,\n \t */\n \tif (i == ARRAY_SIZE(atmel_tcb_divisors)) {\n \t\ti = slowclk;\n-\t\trate = clk_get_rate(tcbpwmc->slow_clk);\n+\t\trate = tcbpwmc->slow_rate;\n \t\tmin = div_u64(NSEC_PER_SEC, rate);\n \t\tmax = min << tcbpwmc->width;\n \n@@ -431,6 +433,7 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)\n \t}\n \n \tchip->ops = &atmel_tcb_pwm_ops;\n+\tchip->atomic = true;\n \ttcbpwmc->channel = channel;\n \ttcbpwmc->width = config->counter_width;\n \n@@ -438,16 +441,33 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)\n \tif (err)\n \t\tgoto err_gclk;\n \n+\terr = clk_rate_exclusive_get(tcbpwmc->clk);\n+\tif (err)\n+\t\tgoto err_disable_clk;\n+\n+\terr = clk_rate_exclusive_get(tcbpwmc->slow_clk);\n+\tif (err)\n+\t\tgoto err_clk_unlock;\n+\n+\ttcbpwmc->rate = clk_get_rate(tcbpwmc->clk);\n+\ttcbpwmc->slow_rate = clk_get_rate(tcbpwmc->slow_clk);\n+\n \tspin_lock_init(&tcbpwmc->lock);\n \n \terr = pwmchip_add(chip);\n \tif (err < 0)\n-\t\tgoto err_disable_clk;\n+\t\tgoto err_slow_clk_unlock;\n \n \tplatform_set_drvdata(pdev, chip);\n \n \treturn 0;\n \n+err_slow_clk_unlock:\n+\tclk_rate_exclusive_put(tcbpwmc->slow_clk);\n+\n+err_clk_unlock:\n+\tclk_rate_exclusive_put(tcbpwmc->clk);\n+\n err_disable_clk:\n \tclk_disable_unprepare(tcbpwmc->slow_clk);\n \n@@ -470,6 +490,8 @@ static void atmel_tcb_pwm_remove(struct platform_device *pdev)\n \n \tpwmchip_remove(chip);\n \n+\tclk_rate_exclusive_put(tcbpwmc->slow_clk);\n+\tclk_rate_exclusive_put(tcbpwmc->clk);\n \tclk_disable_unprepare(tcbpwmc->slow_clk);\n \tclk_put(tcbpwmc->gclk);\n \tclk_put(tcbpwmc->clk);\n",
    "prefixes": [
        "v2"
    ]
}