Commit 78c60f1f authored by Ille, Ondrej, Ing.'s avatar Ille, Ondrej, Ing.

driver: Fix warnings from checkpatch.

parent 9ff91352
......@@ -455,8 +455,8 @@ static void ctucan_err_interrupt(struct net_device *ndev,
ctucan_state_to_str(state));
if (priv->can.state == state)
netdev_warn(ndev, " current and previous state is the same!"
" (missed interrupt?)");
netdev_warn(ndev,
"current and previous state is the same! (missed interrupt?)");
priv->can.state = state;
if (state == CAN_STATE_BUS_OFF) {
......@@ -674,7 +674,8 @@ static void ctucan_tx_interrupt(struct net_device *ndev)
if (first) {
netdev_err(ndev, "BUG: TXB#%u not in a finished state (0x%x)!",
txb_idx, status);
spin_unlock_irqrestore(&priv->tx_lock, flags);
spin_unlock_irqrestore(&priv->tx_lock,
flags);
/* do not clear nor wake */
return;
}
......@@ -1100,7 +1101,7 @@ EXPORT_SYMBOL(ctucan_probe_common);
static __init int ctucan_init(void)
{
printk(KERN_INFO "%s CAN netdevice driver\n", DRV_NAME);
netdev_info("%s CAN netdevice driver\n", DRV_NAME);
return 0;
}
......@@ -1109,7 +1110,7 @@ module_init(ctucan_init);
static __exit void ctucan_exit(void)
{
printk(KERN_INFO "%s: driver removed\n", DRV_NAME);
netdev_info("%s: driver removed\n", DRV_NAME);
}
module_exit(ctucan_exit);
// SPDX-License-Identifier: GPL-2.0+
/*******************************************************************************
/* SPDX-License-Identifier: GPL-2.0+
*******************************************************************************
*
* CTU CAN FD IP Core
* Copyright (C) 2015-2018
......@@ -76,9 +76,11 @@ struct ctucan_priv {
* Return: 0 on success and failure value on error
*/
int ctucan_probe_common(struct device *dev, void __iomem *addr,
int irq, unsigned int ntxbufs, unsigned long can_clk_rate,
int pm_enable_call, void (*set_drvdata_fnc)(struct device *dev,
struct net_device *ndev));
int irq, unsigned int ntxbufs,
unsigned long can_clk_rate,
int pm_enable_call,
void (*set_drvdata_fnc)(struct device *dev,
struct net_device *ndev));
int ctucan_suspend(struct device *dev) __maybe_unused;
int ctucan_resume(struct device *dev) __maybe_unused;
......
// SPDX-License-Identifier: GPL-2.0+
/*******************************************************************************
/* SPDX-License-Identifier: GPL-2.0+
*******************************************************************************
*
* CTU CAN FD IP Core
* Copyright (C) 2015-2018
......
......@@ -35,7 +35,6 @@
#endif
#include "ctu_can_fd_frame.h"
//#include "ctu_can_fd_regs.h"
#include "ctu_can_fd_hw.h"
void ctucan_hw_write32(struct ctucan_hw_priv *priv,
......@@ -648,15 +647,14 @@ bool ctucan_hw_txt_buf_give_command(struct ctucan_hw_priv *priv, u8 cmd, u8 buf)
}
// TODO: use named constants for the command
if (cmd & 0x1) {
if (cmd & 0x1)
reg.s.txce = 1;
} else if (cmd & 0x2) {
else if (cmd & 0x2)
reg.s.txcr = 1;
} else if (cmd & 0x4) {
else if (cmd & 0x4)
reg.s.txca = 1;
} else {
else
return false;
}
priv->write_reg(priv, CTU_CAN_FD_TX_COMMAND, reg.u32);
return true;
......@@ -755,9 +753,8 @@ u64 ctucan_hw_read_timestamp(struct ctucan_hw_priv *priv)
ts_low.u32 = priv->read_reg(priv, CTU_CAN_FD_TIMESTAMP_LOW);
ts_high_2.u32 = priv->read_reg(priv, CTU_CAN_FD_TIMESTAMP_HIGH);
if (ts_high.u32 != ts_high_2.u32) {
if (ts_high.u32 != ts_high_2.u32)
ts_low.u32 = priv->read_reg(priv, CTU_CAN_FD_TIMESTAMP_LOW);
}
return (((u64)ts_high_2.u32) << 32) | ((u64)ts_low.u32);
}
......
// SPDX-License-Identifier: GPL-2.0+
/*******************************************************************************
/* SPDX-License-Identifier: GPL-2.0+
*******************************************************************************
*
* CTU CAN FD IP Core
* Copyright (C) 2015-2018
......@@ -34,22 +34,12 @@
#include <asm/byteorder.h>
#if defined(__LITTLE_ENDIAN_BITFIELD) == defined(__BIG_ENDIAN_BITFIELD)
# error Either __BIG_ENDIAN_BITFIELD or __LITTLE_ENDIAN_BITFIELD must be defined.
# error __BIG_ENDIAN_BITFIELD or __LITTLE_ENDIAN_BITFIELD must be defined.
#endif
#include "ctu_can_fd_regs.h"
#include "ctu_can_fd_frame.h"
/*
MJ TODO:
+ consider move of more small functions to *.h, make them inline
+ either pass union arguments by value or just as u32;
this way they are forced on stack instead of passing in register
+ one level of pointer indirection, which sucks performance-wise
- use u32 directly, as non-primitive types (however small )are not
guaranteed to be passed in registers across all ABIs
*/
#define CTU_CAN_FD_RETR_MAX 15
#define CTU_CAN_FD_FILTER_A 0
......
......@@ -82,7 +82,7 @@ struct ctucan_pci_board_data *ctucan_pci_get_bdata(struct pci_dev *pdev)
}
static void ctucan_pci_set_drvdata(struct device *dev,
struct net_device *ndev)
struct net_device *ndev)
{
struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
struct ctucan_priv *priv = netdev_priv(ndev);
......@@ -103,7 +103,7 @@ static void ctucan_pci_set_drvdata(struct device *dev,
* Return: 0 on success and failure value on error
*/
static int ctucan_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *ent)
const struct pci_device_id *ent)
{
struct device *dev = &pdev->dev;
unsigned long driver_data = ent->driver_data;
......@@ -180,7 +180,6 @@ static int ctucan_pci_probe(struct pci_dev *pdev,
bdata = kzalloc(sizeof(*bdata), GFP_KERNEL);
if (!bdata) {
dev_err(dev, "Cannot allocate board private data\n");
ret = -ENOMEM;
goto err_pci_iounmap_bar0;
}
......@@ -227,19 +226,19 @@ static int ctucan_pci_probe(struct pci_dev *pdev,
err_free_board:
pci_set_drvdata(pdev, NULL);
kfree(bdata);
err_pci_iounmap_bar0:
err_pci_iounmap_bar0:
pci_iounmap(pdev, cra_addr);
err_pci_iounmap_bar1:
err_pci_iounmap_bar1:
pci_iounmap(pdev, addr);
err_release_regions:
err_release_regions:
if (msi_ok) {
pci_disable_msi(pdev);
pci_clear_master(pdev);
}
pci_release_regions(pdev);
err_disable_device:
err_disable_device:
pci_disable_device(pdev);
err:
err:
return ret;
}
......
......@@ -43,10 +43,10 @@ MODULE_DESCRIPTION("CTU CAN FD for platform");
#define DRV_NAME "ctucanfd"
static void ctucan_platform_set_drvdata(struct device *dev,
struct net_device *ndev)
struct net_device *ndev)
{
struct platform_device *pdev = container_of(dev, struct platform_device,
dev);
dev);
platform_set_drvdata(pdev, ndev);
}
......@@ -84,17 +84,12 @@ static int ctucan_platform_probe(struct platform_device *pdev)
goto err;
}
#if 0
/* tntxbufs should be used in future */
ret = of_property_read_u32(pdev->dev.of_node, "tntxbufs", &ntxbufs);
if (ret < 0)
goto err;
#endif
/* Number of tx bufs might be change in HW for future. If so,
* it will be passed as property via device tree
*/
ntxbufs = 4;
ret = ctucan_probe_common(dev, addr, irq, ntxbufs, 0,
1, ctucan_platform_set_drvdata);
1, ctucan_platform_set_drvdata);
if (ret < 0)
platform_set_drvdata(pdev, NULL);
......
// SPDX-License-Identifier: GPL-2.0+
/*******************************************************************************
/* SPDX-License-Identifier: GPL-2.0+
*******************************************************************************
*
* CTU CAN FD IP Core
* Copyright (C) 2015-2018
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment