From patchwork Sun Jan 6 21:55:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Anton Vorontsov X-Patchwork-Id: 1938111 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 03659DF2A2 for ; Sun, 6 Jan 2013 22:01:48 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TryEv-0000G3-S3; Sun, 06 Jan 2013 21:58:46 +0000 Received: from mail-pa0-f50.google.com ([209.85.220.50]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TryEs-0000Fk-Oh for linux-arm-kernel@lists.infradead.org; Sun, 06 Jan 2013 21:58:43 +0000 Received: by mail-pa0-f50.google.com with SMTP id hz10so10307211pad.9 for ; Sun, 06 Jan 2013 13:58:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition :content-transfer-encoding:in-reply-to:user-agent:x-gm-message-state; bh=5wQAbSSO9JAwywweNhAlf7nhLBgsRl3K67yJBTv6hOQ=; b=Q/53Kwz4RHVg2arjDvwRY6Cou9D6/NsfetGxEemQBj/c/Tbm3xJ5MG53fw1ESck9uz E/4lEx+BLA4rOULsfIhTex1edSp5t1vLXURoZFEZyYBc3fbYAXWjfpVtfqKqfJB3f0Of qWVQxFfkyetmdN6n2tBbTNDRhIsH/qOmazLxnS6ghTMxxfLrlxwjfnS2dL2XmdMQ5Dx7 LDIQtaFZOZHmkij8F8ZEJ7GvlZiJ6ww1+tMNY9So3uigYQpwFY4A4e/YldomqQO5bWYg S83tyEnvAugpVb6LNWmkeSP6vbPpKfxyNnmLpJptpuliShQjuyBuehqe/i01nNz9Jv86 Xw4Q== X-Received: by 10.68.194.6 with SMTP id hs6mr181120067pbc.77.1357509521001; Sun, 06 Jan 2013 13:58:41 -0800 (PST) Received: from localhost (ip-64-134-225-81.public.wayport.net. [64.134.225.81]) by mx.google.com with ESMTPS id vs3sm36344342pbc.61.2013.01.06.13.58.39 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 06 Jan 2013 13:58:40 -0800 (PST) Date: Sun, 6 Jan 2013 13:55:09 -0800 From: Anton Vorontsov To: Andrew Lunn Subject: Re: [PATCH 1/4] Power: Reset: Driver to turn QNAP board power off. Message-ID: <20130106215509.GD26928@lizard.sbx05280.losalca.wayport.net> References: <1356697512-3950-1-git-send-email-andrew@lunn.ch> <1356697512-3950-2-git-send-email-andrew@lunn.ch> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1356697512-3950-2-git-send-email-andrew@lunn.ch> User-Agent: Mutt/1.5.21 (2010-09-15) X-Gm-Message-State: ALoCoQkVjxYDA31k1lPw/fMwo/wjE0OoXSJ8fInqlrh++SsU/lSgHYpMPcbiLTzPB5znPSZAI6LS X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130106_165842_985529_E8018DF7 X-CRM114-Status: GOOD ( 22.80 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.50 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Michael Walle , Andrew Lunn , Jason Cooper , linux ARM X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On Fri, Dec 28, 2012 at 01:25:09PM +0100, Andrew Lunn wrote: > From: Andrew Lunn > > The QNAP NAS boxes have a microcontroller attached to the SoCs second > serial port. By sending it a simple command, it will turn the power > for the board off. This driver registers a function for pm_power_off > to send such a command. > > Signed-off-by: Andrew Lunn > --- [...] > +MODULE_LICENSE("GPLv2+"); That doesn't make sense, and probably will result into a T (tainted) flag. The kernel is under GPLv2 license, no '+'. Anyone who touches the code assumes that it is "GPLv2 only". So, any changes on top of your code automatically turns it into "GPLv2 only". IANAL, but that's how I believe things work. Anyway, fixed this warning: CC drivers/power/reset/qnap-poweroff.o drivers/power/reset/qnap-poweroff.c: In function ‘qnap_power_off_probe’: drivers/power/reset/qnap-poweroff.c:80:3: warning: passing argument 1 of ‘lookup_symbol_name’ makes integer from pointer without a cast [enabled by default] In file included from drivers/power/reset/qnap-poweroff.c:21:0: include/linux/kallsyms.h:45:5: note: expected ‘long unsigned int’ but argument is of type ‘void (*)(void)’ ... and have made a few cosmetic changes (see below). But I didn't change the license string, you probably should send a patch for it. diff --git a/Documentation/devicetree/bindings/power_supply/qnap-poweroff.txt b/Documentation/devicetree/bindings/power_supply/qnap-poweroff.txt index 0951952..9a599d2 100644 --- a/Documentation/devicetree/bindings/power_supply/qnap-poweroff.txt +++ b/Documentation/devicetree/bindings/power_supply/qnap-poweroff.txt @@ -11,4 +11,3 @@ Required Properties: - reg: Address and length of the register set for UART1 - clocks: tclk clock - diff --git a/drivers/power/reset/qnap-poweroff.c b/drivers/power/reset/qnap-poweroff.c index ca0b476..cecb317 100644 --- a/drivers/power/reset/qnap-poweroff.c +++ b/drivers/power/reset/qnap-poweroff.c @@ -28,8 +28,7 @@ static void __iomem *base; static unsigned long tclk; -static void -qnap_power_off(void) +static void qnap_power_off(void) { /* 19200 baud divisor */ const unsigned divisor = ((tclk + (8 * 19200)) / (16 * 19200)); @@ -49,28 +48,25 @@ qnap_power_off(void) writel('A', UART1_REG(TX)); } -static int -qnap_power_off_probe(struct platform_device *pdev) +static int qnap_power_off_probe(struct platform_device *pdev) { struct resource *res; struct clk *clk; char symname[KSYM_NAME_LEN]; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (res == NULL) { + if (!res) { dev_err(&pdev->dev, "Missing resource"); return -EINVAL; } - base = devm_ioremap(&pdev->dev, res->start, - resource_size(res)); - if (base == NULL) { + base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); + if (!base) { dev_err(&pdev->dev, "Unable to map resource"); return -EINVAL; } - /* We need to know tclk in order to calculate the UART - divisor */ + /* We need to know tclk in order to calculate the UART divisor */ clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(clk)) { dev_err(&pdev->dev, "Clk missing"); @@ -80,8 +76,8 @@ qnap_power_off_probe(struct platform_device *pdev) tclk = clk_get_rate(clk); /* Check that nothing else has already setup a handler */ - if (pm_power_off != NULL) { - lookup_symbol_name(pm_power_off, symname); + if (pm_power_off) { + lookup_symbol_name((ulong)pm_power_off, symname); dev_err(&pdev->dev, "pm_power_off already claimed %p %s", pm_power_off, symname); @@ -92,11 +88,9 @@ qnap_power_off_probe(struct platform_device *pdev) return 0; } -static int -qnap_power_off_remove(struct platform_device *pdev) +static int qnap_power_off_remove(struct platform_device *pdev) { pm_power_off = NULL; - return 0; } @@ -104,7 +98,6 @@ static const struct of_device_id qnap_power_off_of_match_table[] = { { .compatible = "qnap,power-off", }, {} }; - MODULE_DEVICE_TABLE(of, qnap_power_off_of_match_table); static struct platform_driver qnap_power_off_driver = { @@ -116,7 +109,6 @@ static struct platform_driver qnap_power_off_driver = { .of_match_table = of_match_ptr(qnap_power_off_of_match_table), }, }; - module_platform_driver(qnap_power_off_driver); MODULE_AUTHOR("Andrew Lunn ");