@@ -11,4 +11,3 @@ Required Properties:
- reg: Address and length of the register set for UART1
- clocks: tclk clock
-
@@ -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 <andrew@lunn.ch>");