示例#1
0
static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
	const struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data);
	struct iwl_trans *iwl_trans;
	struct iwl_trans_pcie *trans_pcie;
	int ret;

	iwl_trans = iwl_trans_pcie_alloc(pdev, ent, cfg);
	if (IS_ERR(iwl_trans))
		return PTR_ERR(iwl_trans);

	pci_set_drvdata(pdev, iwl_trans);

	trans_pcie = IWL_TRANS_GET_PCIE_TRANS(iwl_trans);
	trans_pcie->drv = iwl_drv_start(iwl_trans, cfg);

	if (IS_ERR(trans_pcie->drv)) {
		ret = PTR_ERR(trans_pcie->drv);
		goto out_free_trans;
	}

	/* register transport layer debugfs here */
	ret = iwl_trans_dbgfs_register(iwl_trans, iwl_trans->dbgfs_dir);
	if (ret)
		goto out_free_drv;

	return 0;

out_free_drv:
	iwl_drv_stop(trans_pcie->drv);
out_free_trans:
	iwl_trans_pcie_free(iwl_trans);
	return ret;
}
示例#2
0
static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
	const struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data);
	const struct iwl_cfg *cfg_7265d __maybe_unused = NULL;
	struct iwl_trans *iwl_trans;
	struct iwl_trans_pcie *trans_pcie;
	int ret;

	iwl_trans = iwl_trans_pcie_alloc(pdev, ent, cfg);
	if (IS_ERR(iwl_trans))
		return PTR_ERR(iwl_trans);

#if IS_ENABLED(CONFIG_IWLMVM)
	/*
	 * special-case 7265D, it has the same PCI IDs.
	 *
	 * Note that because we already pass the cfg to the transport above,
	 * all the parameters that the transport uses must, until that is
	 * changed, be identical to the ones in the 7265D configuration.
	 */
	if (cfg == &iwl7265_2ac_cfg)
		cfg_7265d = &iwl7265d_2ac_cfg;
	else if (cfg == &iwl7265_2n_cfg)
		cfg_7265d = &iwl7265d_2n_cfg;
	else if (cfg == &iwl7265_n_cfg)
		cfg_7265d = &iwl7265d_n_cfg;
	if (cfg_7265d &&
	    (iwl_trans->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_7265D) {
		cfg = cfg_7265d;
		iwl_trans->cfg = cfg_7265d;
	}
#endif

	pci_set_drvdata(pdev, iwl_trans);

	trans_pcie = IWL_TRANS_GET_PCIE_TRANS(iwl_trans);
	trans_pcie->drv = iwl_drv_start(iwl_trans, cfg);

	if (IS_ERR(trans_pcie->drv)) {
		ret = PTR_ERR(trans_pcie->drv);
		goto out_free_trans;
	}

	set_dflt_pwr_limit(iwl_trans, pdev);

	/* register transport layer debugfs here */
	ret = iwl_trans_dbgfs_register(iwl_trans, iwl_trans->dbgfs_dir);
	if (ret)
		goto out_free_drv;

	return 0;

out_free_drv:
	iwl_drv_stop(trans_pcie->drv);
out_free_trans:
	iwl_trans_pcie_free(iwl_trans);
	return ret;
}
示例#3
0
static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
	const struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data);
	struct iwl_shared *shrd;
	struct iwl_trans *iwl_trans;
	int err;

	shrd = kzalloc(sizeof(*iwl_trans->shrd), GFP_KERNEL);
	if (!shrd) {
		dev_printk(KERN_ERR, &pdev->dev,
			   "Couldn't allocate iwl_shared");
		err = -ENOMEM;
		goto out_free_bus;
	}

#ifdef CONFIG_IWLWIFI_IDI
	iwl_trans = iwl_trans_idi_alloc(shrd, pdev, ent);
#else
	iwl_trans = iwl_trans_pcie_alloc(shrd, pdev, ent);
#endif
	if (iwl_trans == NULL) {
		err = -ENOMEM;
		goto out_free_bus;
	}

	shrd->trans = iwl_trans;
	pci_set_drvdata(pdev, iwl_trans);

	err = iwl_drv_start(shrd, iwl_trans, cfg);
	if (err)
		goto out_free_trans;

	return 0;

out_free_trans:
	iwl_trans_free(iwl_trans);
	pci_set_drvdata(pdev, NULL);
out_free_bus:
	kfree(shrd);
	return err;
}
示例#4
0
static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
	const struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data);
	struct iwl_trans *iwl_trans;
	struct iwl_trans_pcie *trans_pcie;

	iwl_trans = iwl_trans_pcie_alloc(pdev, ent, cfg);
	if (iwl_trans == NULL)
		return -ENOMEM;

	pci_set_drvdata(pdev, iwl_trans);

	trans_pcie = IWL_TRANS_GET_PCIE_TRANS(iwl_trans);
	trans_pcie->drv = iwl_drv_start(iwl_trans, cfg);
	if (!trans_pcie->drv)
		goto out_free_trans;

	return 0;

out_free_trans:
	iwl_trans_pcie_free(iwl_trans);
	pci_set_drvdata(pdev, NULL);
	return -EFAULT;
}
示例#5
0
文件: drv.c 项目: acton393/linux
static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
	const struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data);
	const struct iwl_cfg *cfg_7265d __maybe_unused = NULL;
	struct iwl_trans *iwl_trans;
	int ret;

	iwl_trans = iwl_trans_pcie_alloc(pdev, ent, cfg);
	if (IS_ERR(iwl_trans))
		return PTR_ERR(iwl_trans);

#if IS_ENABLED(CONFIG_IWLMVM)
	/*
	 * special-case 7265D, it has the same PCI IDs.
	 *
	 * Note that because we already pass the cfg to the transport above,
	 * all the parameters that the transport uses must, until that is
	 * changed, be identical to the ones in the 7265D configuration.
	 */
	if (cfg == &iwl7265_2ac_cfg)
		cfg_7265d = &iwl7265d_2ac_cfg;
	else if (cfg == &iwl7265_2n_cfg)
		cfg_7265d = &iwl7265d_2n_cfg;
	else if (cfg == &iwl7265_n_cfg)
		cfg_7265d = &iwl7265d_n_cfg;
	if (cfg_7265d &&
	    (iwl_trans->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_7265D) {
		cfg = cfg_7265d;
		iwl_trans->cfg = cfg_7265d;
	}

	if (iwl_trans->cfg->rf_id) {
		if (cfg == &iwl9460_2ac_cfg &&
		    iwl_trans->hw_rf_id == CSR_HW_RF_ID_TYPE_LC) {
			cfg = &iwl9000lc_2ac_cfg;
			iwl_trans->cfg = cfg;
		}
	}
#endif

	pci_set_drvdata(pdev, iwl_trans);
	iwl_trans->drv = iwl_drv_start(iwl_trans, cfg);

	if (IS_ERR(iwl_trans->drv)) {
		ret = PTR_ERR(iwl_trans->drv);
		goto out_free_trans;
	}

	set_dflt_pwr_limit(iwl_trans, pdev);

	/* register transport layer debugfs here */
	ret = iwl_trans_pcie_dbgfs_register(iwl_trans);
	if (ret)
		goto out_free_drv;

	/* if RTPM is in use, enable it in our device */
	if (iwl_trans->runtime_pm_mode != IWL_PLAT_PM_MODE_DISABLED) {
		/* We explicitly set the device to active here to
		 * clear contingent errors.
		 */
		pm_runtime_set_active(&pdev->dev);

		pm_runtime_set_autosuspend_delay(&pdev->dev,
					 iwlwifi_mod_params.d0i3_entry_delay);
		pm_runtime_use_autosuspend(&pdev->dev);

		/* We are not supposed to call pm_runtime_allow() by
		 * ourselves, but let userspace enable runtime PM via
		 * sysfs.  However, since we don't enable this from
		 * userspace yet, we need to allow/forbid() ourselves.
		*/
		pm_runtime_allow(&pdev->dev);
	}

	/* The PCI device starts with a reference taken and we are
	 * supposed to release it here.  But to simplify the
	 * interaction with the opmode, we don't do it now, but let
	 * the opmode release it when it's ready.
	 */

	return 0;

out_free_drv:
	iwl_drv_stop(iwl_trans->drv);
out_free_trans:
	iwl_trans_pcie_free(iwl_trans);
	return ret;
}