Commit def07668 authored by Pavel Pisa's avatar Pavel Pisa

Merge branch '343-pci-driver-exception-when-signature-not-found' into 'master'

Resolve "PCI driver exception when signature not found."

Closes #343

See merge request !304
parents e015bf36 8adc8c56
...@@ -50,7 +50,7 @@ MODULE_DESCRIPTION("CTU CAN FD interface"); ...@@ -50,7 +50,7 @@ MODULE_DESCRIPTION("CTU CAN FD interface");
#define DRV_NAME "ctucanfd" #define DRV_NAME "ctucanfd"
static const char *ctucan_state_strings[] = { static const char * const ctucan_state_strings[] = {
"CAN_STATE_ERROR_ACTIVE", "CAN_STATE_ERROR_ACTIVE",
"CAN_STATE_ERROR_WARNING", "CAN_STATE_ERROR_WARNING",
"CAN_STATE_ERROR_PASSIVE", "CAN_STATE_ERROR_PASSIVE",
...@@ -164,14 +164,14 @@ static int ctucan_set_secondary_sample_point(struct net_device *ndev) ...@@ -164,14 +164,14 @@ static int ctucan_set_secondary_sample_point(struct net_device *ndev)
} }
// Use for bit-rates above 1 Mbits/s // Use for bit-rates above 1 Mbits/s
if (dbt->bitrate > 1000000){ if (dbt->bitrate > 1000000) {
ssp_ena = true; ssp_ena = true;
// Calculate SSP in minimal time quanta // Calculate SSP in minimal time quanta
ssp_offset = (priv->can.clock.freq / 1000) * ssp_offset = (priv->can.clock.freq / 1000) *
dbt->sample_point / dbt->bitrate; dbt->sample_point / dbt->bitrate;
if (ssp_offset > 127){ if (ssp_offset > 127) {
netdev_warn(ndev, "SSP offset saturated to 127\n"); netdev_warn(ndev, "SSP offset saturated to 127\n");
ssp_offset = 127; ssp_offset = 127;
} }
...@@ -330,7 +330,7 @@ static int ctucan_start_xmit(struct sk_buff *skb, struct net_device *ndev) ...@@ -330,7 +330,7 @@ static int ctucan_start_xmit(struct sk_buff *skb, struct net_device *ndev)
if (!ok) { if (!ok) {
netdev_err(ndev, netdev_err(ndev,
"BUG! TXNF set but cannot insert frame into TXTB! HW Bug?"); "BUG! TXNF set but cannot insert frame into TXTB! HW Bug?");
return NETDEV_TX_BUSY; return NETDEV_TX_BUSY;
} }
can_put_echo_skb(skb, ndev, txb_id); can_put_echo_skb(skb, ndev, txb_id);
...@@ -1056,6 +1056,7 @@ int ctucan_probe_common(struct device *dev, void __iomem *addr, ...@@ -1056,6 +1056,7 @@ int ctucan_probe_common(struct device *dev, void __iomem *addr,
if ((priv->p.read_reg(&priv->p, CTU_CAN_FD_DEVICE_ID) & if ((priv->p.read_reg(&priv->p, CTU_CAN_FD_DEVICE_ID) &
0xFFFF) != CTU_CAN_FD_ID) { 0xFFFF) != CTU_CAN_FD_ID) {
netdev_err(ndev, "CTU_CAN_FD signature not found\n"); netdev_err(ndev, "CTU_CAN_FD signature not found\n");
ret = -ENODEV;
goto err_disableclks; goto err_disableclks;
} }
} }
...@@ -1098,16 +1099,16 @@ EXPORT_SYMBOL(ctucan_probe_common); ...@@ -1098,16 +1099,16 @@ EXPORT_SYMBOL(ctucan_probe_common);
static __init int ctucan_init(void) static __init int ctucan_init(void)
{ {
printk(KERN_INFO "%s CAN netdevice driver\n", DRV_NAME); printk(KERN_INFO "%s CAN netdevice driver\n", DRV_NAME);
return 0; return 0;
} }
module_init(ctucan_init); module_init(ctucan_init);
static __exit void ctucan_exit(void) static __exit void ctucan_exit(void)
{ {
printk(KERN_INFO "%s: driver removed\n", DRV_NAME); printk(KERN_INFO "%s: driver removed\n", DRV_NAME);
} }
module_exit(ctucan_exit); module_exit(ctucan_exit);
...@@ -767,7 +767,7 @@ void ctucan_hw_configure_ssp(struct ctucan_hw_priv *priv, bool enable_ssp, ...@@ -767,7 +767,7 @@ void ctucan_hw_configure_ssp(struct ctucan_hw_priv *priv, bool enable_ssp,
union ctu_can_fd_trv_delay_ssp_cfg ssp_cfg; union ctu_can_fd_trv_delay_ssp_cfg ssp_cfg;
ssp_cfg.u32 = 0; ssp_cfg.u32 = 0;
if (enable_ssp){ if (enable_ssp) {
if (use_trv_delay) if (use_trv_delay)
ssp_cfg.s.ssp_src = SSP_SRC_MEAS_N_OFFSET; ssp_cfg.s.ssp_src = SSP_SRC_MEAS_N_OFFSET;
else else
......
...@@ -223,7 +223,7 @@ static int ctucan_pci_probe(struct pci_dev *pdev, ...@@ -223,7 +223,7 @@ static int ctucan_pci_probe(struct pci_dev *pdev,
return 0; return 0;
err_free_board: err_free_board:
pci_set_drvdata(pdev, NULL); pci_set_drvdata(pdev, NULL);
kfree(bdata); kfree(bdata);
err_pci_iounmap_bar0: err_pci_iounmap_bar0:
...@@ -272,28 +272,28 @@ static void ctucan_pci_remove(struct pci_dev *pdev) ...@@ -272,28 +272,28 @@ static void ctucan_pci_remove(struct pci_dev *pdev)
struct ctucan_priv, peers_on_pdev)) != NULL) { struct ctucan_priv, peers_on_pdev)) != NULL) {
ndev = priv->can.dev; ndev = priv->can.dev;
unregister_candev(ndev); unregister_candev(ndev);
netif_napi_del(&priv->napi); netif_napi_del(&priv->napi);
list_del_init(&priv->peers_on_pdev); list_del_init(&priv->peers_on_pdev);
free_candev(ndev); free_candev(ndev);
} }
pci_iounmap(pdev, bdata->bar1_base); pci_iounmap(pdev, bdata->bar1_base);
if (bdata->use_msi) { if (bdata->use_msi) {
pci_disable_msi(pdev); pci_disable_msi(pdev);
pci_clear_master(pdev); pci_clear_master(pdev);
} }
pci_release_regions(pdev); pci_release_regions(pdev);
pci_disable_device(pdev); pci_disable_device(pdev);
pci_iounmap(pdev, bdata->bar0_base); pci_iounmap(pdev, bdata->bar0_base);
pci_set_drvdata(pdev, NULL); pci_set_drvdata(pdev, NULL);
kfree(bdata); kfree(bdata);
} }
static SIMPLE_DEV_PM_OPS(ctucan_pci_pm_ops, ctucan_suspend, ctucan_resume); static SIMPLE_DEV_PM_OPS(ctucan_pci_pm_ops, ctucan_suspend, ctucan_resume);
......
...@@ -97,7 +97,8 @@ static int ctucan_platform_probe(struct platform_device *pdev) ...@@ -97,7 +97,8 @@ static int ctucan_platform_probe(struct platform_device *pdev)
if (ret < 0) if (ret < 0)
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
err:
err:
return ret; return ret;
} }
......
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