Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/37417/?format=api
{ "id": 37417, "url": "http://patchwork.ozlabs.org/api/patches/37417/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20091102135244.GC4696@pengutronix.de/", "project": { "id": 2, "url": "http://patchwork.ozlabs.org/api/projects/2/?format=api", "name": "Linux PPC development", "link_name": "linuxppc-dev", "list_id": "linuxppc-dev.lists.ozlabs.org", "list_email": "linuxppc-dev@lists.ozlabs.org", "web_url": "https://github.com/linuxppc/wiki/wiki", "scm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git", "webscm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/", "list_archive_url_format": "https://lore.kernel.org/linuxppc-dev/{}/", "commit_url_format": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}" }, "msgid": "<20091102135244.GC4696@pengutronix.de>", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20091102135244.GC4696@pengutronix.de/", "date": "2009-11-02T13:53:11", "name": "spi/mpc52xx: check for invalid PSC usage", "commit_ref": null, "pull_url": null, "state": "awaiting-upstream", "archived": true, "hash": "4932382fa70916e104e46d39ceab95e82526f16d", "submitter": { "id": 263, "url": "http://patchwork.ozlabs.org/api/people/263/?format=api", "name": "Wolfram Sang", "email": "w.sang@pengutronix.de" }, "delegate": { "id": 8, "url": "http://patchwork.ozlabs.org/api/users/8/?format=api", "username": "glikely", "first_name": "Grant", "last_name": "Likely", "email": "grant.likely@secretlab.ca" }, "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20091102135244.GC4696@pengutronix.de/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/37417/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/37417/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": [ "patchwork-incoming@ozlabs.org", "linuxppc-dev@ozlabs.org" ], "Received": [ "from bilbo.ozlabs.org (localhost [127.0.0.1])\n\tby ozlabs.org (Postfix) with ESMTP id D982610094D\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 3 Nov 2009 00:53:34 +1100 (EST)", "by ozlabs.org (Postfix)\n\tid A31DAB7BFC; Tue, 3 Nov 2009 00:53:26 +1100 (EST)", "from metis.ext.pengutronix.de (metis.ext.pengutronix.de\n\t[92.198.50.35]) by ozlabs.org (Postfix) with ESMTP id 327B9B7BFB\n\tfor <linuxppc-dev@ozlabs.org>; Tue, 3 Nov 2009 00:53:26 +1100 (EST)", "from [2001:6f8:1178:2:221:70ff:fe71:1890] (helo=pengutronix.de)\n\tby metis.ext.pengutronix.de with esmtp (Exim 4.63)\n\t(envelope-from <w.sang@pengutronix.de>)\n\tid 1N4xLO-0006Rw-7p; Mon, 02 Nov 2009 14:53:14 +0100" ], "Date": "Mon, 2 Nov 2009 14:53:11 +0100", "From": "Wolfram Sang <w.sang@pengutronix.de>", "To": "Grant Likely <grant.likely@secretlab.ca>", "Subject": "Re: [PATCH] spi/mpc52xx: check for invalid PSC usage", "Message-ID": "<20091102135244.GC4696@pengutronix.de>", "References": "<1256297157-28246-1-git-send-email-w.sang@pengutronix.de>\n\t<fa686aa40910311822i4ba27b2bs350c5684cd57187b@mail.gmail.com>", "MIME-Version": "1.0", "In-Reply-To": "<fa686aa40910311822i4ba27b2bs350c5684cd57187b@mail.gmail.com>", "User-Agent": "Mutt/1.5.18 (2008-05-17)", "X-SA-Exim-Connect-IP": "2001:6f8:1178:2:221:70ff:fe71:1890", "X-SA-Exim-Mail-From": "w.sang@pengutronix.de", "X-SA-Exim-Scanned": "No (on metis.ext.pengutronix.de);\n\tSAEximRunCond expanded to false", "X-PTX-Original-Recipient": "linuxppc-dev@ozlabs.org", "Cc": "spi-devel-general@lists.sourceforge.net,\n\tDavid Brownell <dbrownell@users.sourceforge.net>, linuxppc-dev@ozlabs.org", "X-BeenThere": "linuxppc-dev@lists.ozlabs.org", "X-Mailman-Version": "2.1.12", "Precedence": "list", "List-Id": "Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>", "List-Unsubscribe": "<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>", "List-Archive": "<http://lists.ozlabs.org/pipermail/linuxppc-dev>", "List-Post": "<mailto:linuxppc-dev@lists.ozlabs.org>", "List-Help": "<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>", "List-Subscribe": "<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>", "Content-Type": "multipart/mixed;\n\tboundary=\"===============8495446162870208466==\"", "Sender": "linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org", "Errors-To": "linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org" }, "content": "> I wouldn't even bother. It's not actively dangerous to try and use\n> PSC{4,5} in SPI mode. It just not going to work. Besides, the\n> MPC5200 common code already checks for an invalid PSC number when\n> setting the clock divisor.\n> \n> Have you seen cases of users trying to do the wrong thing with the\n> crippled PSCs?\n\nYes, that was the reason for this patch :) How about this patch to give users a\nbetter idea than just -ENODEV via set_psc_clkdiv? ...[/me hacks]...\nUuuh, there is even a bug which makes the case go unnoticed.", "diff": "===\n\nSubject: [PATCH] spi/mpc52xx-psc-spi: check for valid PSC\n\nThis driver calls mpc52xx_set_psc_clkdiv() but doesn't check its return value\nto see if the PSC is actually valid for SPI use. Add the check and a hint for\nthe user.\n\nSigned-off-by: Wolfram Sang <w.sang@pengutronix.de>\nCc: Grant Likely <grant.likely@secretlab.ca>\n---\n drivers/spi/mpc52xx_psc_spi.c | 12 ++++++++----\n 1 files changed, 8 insertions(+), 4 deletions(-)\n\ndiff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c\nindex 1b74d5c..e268437 100644\n--- a/drivers/spi/mpc52xx_psc_spi.c\n+++ b/drivers/spi/mpc52xx_psc_spi.c\n@@ -313,11 +313,13 @@ static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps)\n \tstruct mpc52xx_psc __iomem *psc = mps->psc;\n \tstruct mpc52xx_psc_fifo __iomem *fifo = mps->fifo;\n \tu32 mclken_div;\n-\tint ret = 0;\n+\tint ret;\n \n \t/* default sysclk is 512MHz */\n \tmclken_div = (mps->sysclk ? mps->sysclk : 512000000) / MCLK;\n-\tmpc52xx_set_psc_clkdiv(psc_id, mclken_div);\n+\tret = mpc52xx_set_psc_clkdiv(psc_id, mclken_div);\n+\tif (ret)\n+\t\treturn ret;\n \n \t/* Reset the PSC into a known state */\n \tout_8(&psc->command, MPC52xx_PSC_RST_RX);\n@@ -341,7 +343,7 @@ static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps)\n \n \tmps->bits_per_word = 8;\n \n-\treturn ret;\n+\treturn 0;\n }\n \n static irqreturn_t mpc52xx_psc_spi_isr(int irq, void *dev_id)\n@@ -410,8 +412,10 @@ static int __init mpc52xx_psc_spi_do_probe(struct device *dev, u32 regaddr,\n \t\tgoto free_master;\n \n \tret = mpc52xx_psc_spi_port_config(master->bus_num, mps);\n-\tif (ret < 0)\n+\tif (ret < 0) {\n+\t\tdev_err(dev, \"can't configure PSC! Is it capable of SPI?\\n\");\n \t\tgoto free_irq;\n+\t}\n \n \tspin_lock_init(&mps->lock);\n \tinit_completion(&mps->done);\n", "prefixes": [] }