Search Linux Wireless

Re: [PATCH net-next v5 03/13] net: wwan: t7xx: Add core components

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 24, 2022 at 1:35 AM Ricardo Martinez
<ricardo.martinez@xxxxxxxxxxxxxxx> wrote:
> From: Haijun Liu <haijun.liu@xxxxxxxxxxxx>
>
> Registers the t7xx device driver with the kernel. Setup all the core
> components: PCIe layer, Modem Host Cross Core Interface (MHCCIF),
> modem control operations, modem state machine, and build
> infrastructure.
>
> * PCIe layer code implements driver probe and removal.
> * MHCCIF provides interrupt channels to communicate events
>   such as handshake, PM and port enumeration.
> * Modem control implements the entry point for modem init,
>   reset and exit.
> * The modem status monitor is a state machine used by modem control
>   to complete initialization and stop. It is used also to propagate
>   exception events reported by other components.

[skipped]

> +static struct t7xx_modem *t7xx_md_alloc(struct t7xx_pci_dev *t7xx_dev)
> +{
> +       struct device *dev = &t7xx_dev->pdev->dev;
> +       struct t7xx_modem *md;
> +
> +       md = devm_kzalloc(dev, sizeof(*md), GFP_KERNEL);
> +       if (!md)
> +               return NULL;
> +
> +       md->t7xx_dev = t7xx_dev;
> +       t7xx_dev->md = md;
> +       md->core_md.ready = false;
> +       spin_lock_init(&md->exp_lock);
> +       md->handshake_wq = alloc_workqueue("%s", WQ_UNBOUND | WQ_MEM_RECLAIM | WQ_HIGHPRI,
> +                                          0, "md_hk_wq");
> +       if (!md->handshake_wq)
> +               return NULL;
> +
> +       INIT_WORK(&md->handshake_work, t7xx_md_hk_wq);
> +       return md;
> +}
> +
> +int t7xx_md_reset(struct t7xx_pci_dev *t7xx_dev)
> +{
> +       struct t7xx_modem *md = t7xx_dev->md;
> +
> +       md->md_init_finish = false;
> +       md->exp_id = 0;
> +       spin_lock_init(&md->exp_lock);

Looks like a duplicated initialization, the first time the lock was
initialized in the t7xx_md_alloc() above.

> +       t7xx_fsm_reset(md);
> +       t7xx_cldma_reset(md->md_ctrl[CLDMA_ID_MD]);
> +       md->md_init_finish = true;
> +       return 0;
> +}

[skipped]

> +void t7xx_pcie_set_mac_msix_cfg(struct t7xx_pci_dev *t7xx_dev, unsigned int irq_count)
> +{
> +       u32 val;
> +
> +       val = ffs(irq_count) * 2 - 1;

Move this initialization to the variable declaration.

> +       iowrite32(val, IREG_BASE(t7xx_dev) + T7XX_PCIE_CFG_MSIX);
> +}

--
Sergey



[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux