All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v9 2/7] i3c: master: use i3c_master_register only for main master
@ 2020-11-29 17:12 kernel test robot
  0 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2020-11-29 17:12 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 15206 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <1606659745-19420-1-git-send-email-pthombar@cadence.com>
References: <1606659745-19420-1-git-send-email-pthombar@cadence.com>
TO: Parshuram Thombare <pthombar@cadence.com>
TO: alexandre.belloni(a)bootlin.com
TO: slongerbeam(a)gmail.com
TO: vitor.soares(a)synopsys.com
CC: linux-i3c(a)lists.infradead.org
CC: linux-kernel(a)vger.kernel.org
CC: mparab(a)cadence.com
CC: praneeth(a)ti.com
CC: Parshuram Thombare <pthombar@cadence.com>

Hi Parshuram,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on next-20201127]
[cannot apply to linus/master v5.10-rc5 v5.10-rc4 v5.10-rc3 v5.10-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Parshuram-Thombare/I3C-mastership-handover-support/20201129-222847
base:    6174f05255e65622ff3340257879a4c0f858b0df
:::::: branch date: 3 hours ago
:::::: commit date: 3 hours ago
config: i386-randconfig-m021-20201129 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
drivers/i3c/master.c:1697 i3c_primary_master_bus_init() warn: passing a valid pointer to 'PTR_ERR'

Old smatch warnings:
drivers/i3c/master.c:462 mode_show() warn: unsigned 'i3cbus->mode' is never less than zero.
drivers/i3c/master.c:1594 i3c_master_set_info() warn: passing a valid pointer to 'PTR_ERR'
drivers/i3c/master.c:1868 i3c_master_add_i3c_dev_locked() warn: passing a valid pointer to 'PTR_ERR'

vim +/PTR_ERR +1697 drivers/i3c/master.c

3a379bbcea0af6 Boris Brezillon    2017-07-19  1638  
3a379bbcea0af6 Boris Brezillon    2017-07-19  1639  /**
963007469aa0a7 Parshuram Thombare 2020-11-29  1640   * i3c_primary_master_bus_init() - initialize an I3C bus
3a379bbcea0af6 Boris Brezillon    2017-07-19  1641   * @master: main master initializing the bus
3a379bbcea0af6 Boris Brezillon    2017-07-19  1642   *
3a379bbcea0af6 Boris Brezillon    2017-07-19  1643   * This function is following all initialisation steps described in the I3C
3a379bbcea0af6 Boris Brezillon    2017-07-19  1644   * specification:
3a379bbcea0af6 Boris Brezillon    2017-07-19  1645   *
cc3a392d69b62e Parshuram Thombare 2020-08-25  1646   * 1. Attach I2C devs to the master so that the master can fill its internal
cc3a392d69b62e Parshuram Thombare 2020-08-25  1647   *    device table appropriately
3a379bbcea0af6 Boris Brezillon    2017-07-19  1648   *
3a379bbcea0af6 Boris Brezillon    2017-07-19  1649   * 2. Call &i3c_master_controller_ops->bus_init() method to initialize
3a379bbcea0af6 Boris Brezillon    2017-07-19  1650   *    the master controller. That's usually where the bus mode is selected
3a379bbcea0af6 Boris Brezillon    2017-07-19  1651   *    (pure bus or mixed fast/slow bus)
3a379bbcea0af6 Boris Brezillon    2017-07-19  1652   *
3a379bbcea0af6 Boris Brezillon    2017-07-19  1653   * 3. Instruct all devices on the bus to drop their dynamic address. This is
3a379bbcea0af6 Boris Brezillon    2017-07-19  1654   *    particularly important when the bus was previously configured by someone
3a379bbcea0af6 Boris Brezillon    2017-07-19  1655   *    else (for example the bootloader)
3a379bbcea0af6 Boris Brezillon    2017-07-19  1656   *
3a379bbcea0af6 Boris Brezillon    2017-07-19  1657   * 4. Disable all slave events.
3a379bbcea0af6 Boris Brezillon    2017-07-19  1658   *
cc3a392d69b62e Parshuram Thombare 2020-08-25  1659   * 5. Reserve address slots for I3C devices with init_dyn_addr. And if devices
cc3a392d69b62e Parshuram Thombare 2020-08-25  1660   *    also have static_addr, try to pre-assign dynamic addresses requested by
cc3a392d69b62e Parshuram Thombare 2020-08-25  1661   *    the FW with SETDASA and attach corresponding statically defined I3C
cc3a392d69b62e Parshuram Thombare 2020-08-25  1662   *    devices to the master.
3a379bbcea0af6 Boris Brezillon    2017-07-19  1663   *
3a379bbcea0af6 Boris Brezillon    2017-07-19  1664   * 6. Do a DAA (Dynamic Address Assignment) to assign dynamic addresses to all
3a379bbcea0af6 Boris Brezillon    2017-07-19  1665   *    remaining I3C devices
3a379bbcea0af6 Boris Brezillon    2017-07-19  1666   *
3a379bbcea0af6 Boris Brezillon    2017-07-19  1667   * Once this is done, all I3C and I2C devices should be usable.
3a379bbcea0af6 Boris Brezillon    2017-07-19  1668   *
3a379bbcea0af6 Boris Brezillon    2017-07-19  1669   * Return: a 0 in case of success, an negative error code otherwise.
3a379bbcea0af6 Boris Brezillon    2017-07-19  1670   */
963007469aa0a7 Parshuram Thombare 2020-11-29  1671  static int i3c_primary_master_bus_init(struct i3c_master_controller *master)
3a379bbcea0af6 Boris Brezillon    2017-07-19  1672  {
3a379bbcea0af6 Boris Brezillon    2017-07-19  1673  	enum i3c_addr_slot_status status;
3a379bbcea0af6 Boris Brezillon    2017-07-19  1674  	struct i2c_dev_boardinfo *i2cboardinfo;
3a379bbcea0af6 Boris Brezillon    2017-07-19  1675  	struct i3c_dev_boardinfo *i3cboardinfo;
3a379bbcea0af6 Boris Brezillon    2017-07-19  1676  	struct i2c_dev_desc *i2cdev;
3a379bbcea0af6 Boris Brezillon    2017-07-19  1677  	int ret;
3a379bbcea0af6 Boris Brezillon    2017-07-19  1678  
3a379bbcea0af6 Boris Brezillon    2017-07-19  1679  	/*
3a379bbcea0af6 Boris Brezillon    2017-07-19  1680  	 * First attach all devices with static definitions provided by the
3a379bbcea0af6 Boris Brezillon    2017-07-19  1681  	 * FW.
3a379bbcea0af6 Boris Brezillon    2017-07-19  1682  	 */
3a379bbcea0af6 Boris Brezillon    2017-07-19  1683  	list_for_each_entry(i2cboardinfo, &master->boardinfo.i2c, node) {
3a379bbcea0af6 Boris Brezillon    2017-07-19  1684  		status = i3c_bus_get_addr_slot_status(&master->bus,
3a379bbcea0af6 Boris Brezillon    2017-07-19  1685  						      i2cboardinfo->base.addr);
3a379bbcea0af6 Boris Brezillon    2017-07-19  1686  		if (status != I3C_ADDR_SLOT_FREE) {
3a379bbcea0af6 Boris Brezillon    2017-07-19  1687  			ret = -EBUSY;
3a379bbcea0af6 Boris Brezillon    2017-07-19  1688  			goto err_detach_devs;
3a379bbcea0af6 Boris Brezillon    2017-07-19  1689  		}
3a379bbcea0af6 Boris Brezillon    2017-07-19  1690  
3a379bbcea0af6 Boris Brezillon    2017-07-19  1691  		i3c_bus_set_addr_slot_status(&master->bus,
3a379bbcea0af6 Boris Brezillon    2017-07-19  1692  					     i2cboardinfo->base.addr,
3a379bbcea0af6 Boris Brezillon    2017-07-19  1693  					     I3C_ADDR_SLOT_I2C_DEV);
3a379bbcea0af6 Boris Brezillon    2017-07-19  1694  
3a379bbcea0af6 Boris Brezillon    2017-07-19  1695  		i2cdev = i3c_master_alloc_i2c_dev(master, i2cboardinfo);
3a379bbcea0af6 Boris Brezillon    2017-07-19  1696  		if (IS_ERR(i2cdev)) {
3a379bbcea0af6 Boris Brezillon    2017-07-19 @1697  			ret = PTR_ERR(i2cdev);
3a379bbcea0af6 Boris Brezillon    2017-07-19  1698  			goto err_detach_devs;
3a379bbcea0af6 Boris Brezillon    2017-07-19  1699  		}
3a379bbcea0af6 Boris Brezillon    2017-07-19  1700  
3a379bbcea0af6 Boris Brezillon    2017-07-19  1701  		ret = i3c_master_attach_i2c_dev(master, i2cdev);
3a379bbcea0af6 Boris Brezillon    2017-07-19  1702  		if (ret) {
3a379bbcea0af6 Boris Brezillon    2017-07-19  1703  			i3c_master_free_i2c_dev(i2cdev);
3a379bbcea0af6 Boris Brezillon    2017-07-19  1704  			goto err_detach_devs;
3a379bbcea0af6 Boris Brezillon    2017-07-19  1705  		}
3a379bbcea0af6 Boris Brezillon    2017-07-19  1706  	}
3a379bbcea0af6 Boris Brezillon    2017-07-19  1707  
3a379bbcea0af6 Boris Brezillon    2017-07-19  1708  	/*
3a379bbcea0af6 Boris Brezillon    2017-07-19  1709  	 * Now execute the controller specific ->bus_init() routine, which
3a379bbcea0af6 Boris Brezillon    2017-07-19  1710  	 * might configure its internal logic to match the bus limitations.
3a379bbcea0af6 Boris Brezillon    2017-07-19  1711  	 */
3a379bbcea0af6 Boris Brezillon    2017-07-19  1712  	ret = master->ops->bus_init(master);
3a379bbcea0af6 Boris Brezillon    2017-07-19  1713  	if (ret)
3a379bbcea0af6 Boris Brezillon    2017-07-19  1714  		goto err_detach_devs;
3a379bbcea0af6 Boris Brezillon    2017-07-19  1715  
3a379bbcea0af6 Boris Brezillon    2017-07-19  1716  	/*
3a379bbcea0af6 Boris Brezillon    2017-07-19  1717  	 * The master device should have been instantiated in ->bus_init(),
3a379bbcea0af6 Boris Brezillon    2017-07-19  1718  	 * complain if this was not the case.
3a379bbcea0af6 Boris Brezillon    2017-07-19  1719  	 */
3a379bbcea0af6 Boris Brezillon    2017-07-19  1720  	if (!master->this) {
3a379bbcea0af6 Boris Brezillon    2017-07-19  1721  		dev_err(&master->dev,
3a379bbcea0af6 Boris Brezillon    2017-07-19  1722  			"master_set_info() was not called in ->bus_init()\n");
3a379bbcea0af6 Boris Brezillon    2017-07-19  1723  		ret = -EINVAL;
3a379bbcea0af6 Boris Brezillon    2017-07-19  1724  		goto err_bus_cleanup;
3a379bbcea0af6 Boris Brezillon    2017-07-19  1725  	}
3a379bbcea0af6 Boris Brezillon    2017-07-19  1726  
3a379bbcea0af6 Boris Brezillon    2017-07-19  1727  	/*
3a379bbcea0af6 Boris Brezillon    2017-07-19  1728  	 * Reset all dynamic address that may have been assigned before
3a379bbcea0af6 Boris Brezillon    2017-07-19  1729  	 * (assigned by the bootloader for example).
3a379bbcea0af6 Boris Brezillon    2017-07-19  1730  	 */
3a379bbcea0af6 Boris Brezillon    2017-07-19  1731  	ret = i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR);
3a379bbcea0af6 Boris Brezillon    2017-07-19  1732  	if (ret && ret != I3C_ERROR_M2)
3a379bbcea0af6 Boris Brezillon    2017-07-19  1733  		goto err_bus_cleanup;
3a379bbcea0af6 Boris Brezillon    2017-07-19  1734  
3a379bbcea0af6 Boris Brezillon    2017-07-19  1735  	/* Disable all slave events before starting DAA. */
3a379bbcea0af6 Boris Brezillon    2017-07-19  1736  	ret = i3c_master_disec_locked(master, I3C_BROADCAST_ADDR,
3a379bbcea0af6 Boris Brezillon    2017-07-19  1737  				      I3C_CCC_EVENT_SIR | I3C_CCC_EVENT_MR |
3a379bbcea0af6 Boris Brezillon    2017-07-19  1738  				      I3C_CCC_EVENT_HJ);
3a379bbcea0af6 Boris Brezillon    2017-07-19  1739  	if (ret && ret != I3C_ERROR_M2)
3a379bbcea0af6 Boris Brezillon    2017-07-19  1740  		goto err_bus_cleanup;
3a379bbcea0af6 Boris Brezillon    2017-07-19  1741  
3a379bbcea0af6 Boris Brezillon    2017-07-19  1742  	/*
cc3a392d69b62e Parshuram Thombare 2020-08-25  1743  	 * Reserve init_dyn_addr first, and then try to pre-assign dynamic
cc3a392d69b62e Parshuram Thombare 2020-08-25  1744  	 * address and retrieve device information if needed.
cc3a392d69b62e Parshuram Thombare 2020-08-25  1745  	 * In case pre-assign dynamic address fails, setting dynamic address to
cc3a392d69b62e Parshuram Thombare 2020-08-25  1746  	 * the requested init_dyn_addr is retried after DAA is done in
cc3a392d69b62e Parshuram Thombare 2020-08-25  1747  	 * i3c_master_add_i3c_dev_locked().
cc3a392d69b62e Parshuram Thombare 2020-08-25  1748  	 */
cc3a392d69b62e Parshuram Thombare 2020-08-25  1749  	list_for_each_entry(i3cboardinfo, &master->boardinfo.i3c, node) {
cc3a392d69b62e Parshuram Thombare 2020-08-25  1750  
cc3a392d69b62e Parshuram Thombare 2020-08-25  1751  		/*
cc3a392d69b62e Parshuram Thombare 2020-08-25  1752  		 * We don't reserve a dynamic address for devices that
cc3a392d69b62e Parshuram Thombare 2020-08-25  1753  		 * don't explicitly request one.
cc3a392d69b62e Parshuram Thombare 2020-08-25  1754  		 */
cc3a392d69b62e Parshuram Thombare 2020-08-25  1755  		if (!i3cboardinfo->init_dyn_addr)
cc3a392d69b62e Parshuram Thombare 2020-08-25  1756  			continue;
cc3a392d69b62e Parshuram Thombare 2020-08-25  1757  
cc3a392d69b62e Parshuram Thombare 2020-08-25  1758  		ret = i3c_bus_get_addr_slot_status(&master->bus,
cc3a392d69b62e Parshuram Thombare 2020-08-25  1759  						   i3cboardinfo->init_dyn_addr);
cc3a392d69b62e Parshuram Thombare 2020-08-25  1760  		if (ret != I3C_ADDR_SLOT_FREE) {
cc3a392d69b62e Parshuram Thombare 2020-08-25  1761  			ret = -EBUSY;
cc3a392d69b62e Parshuram Thombare 2020-08-25  1762  			goto err_rstdaa;
cc3a392d69b62e Parshuram Thombare 2020-08-25  1763  		}
cc3a392d69b62e Parshuram Thombare 2020-08-25  1764  
cc3a392d69b62e Parshuram Thombare 2020-08-25  1765  		i3c_bus_set_addr_slot_status(&master->bus,
cc3a392d69b62e Parshuram Thombare 2020-08-25  1766  					     i3cboardinfo->init_dyn_addr,
cc3a392d69b62e Parshuram Thombare 2020-08-25  1767  					     I3C_ADDR_SLOT_I3C_DEV);
cc3a392d69b62e Parshuram Thombare 2020-08-25  1768  
cc3a392d69b62e Parshuram Thombare 2020-08-25  1769  		/*
cc3a392d69b62e Parshuram Thombare 2020-08-25  1770  		 * Only try to create/attach devices that have a static
cc3a392d69b62e Parshuram Thombare 2020-08-25  1771  		 * address. Other devices will be created/attached when
cc3a392d69b62e Parshuram Thombare 2020-08-25  1772  		 * DAA happens, and the requested dynamic address will
cc3a392d69b62e Parshuram Thombare 2020-08-25  1773  		 * be set using SETNEWDA once those devices become
cc3a392d69b62e Parshuram Thombare 2020-08-25  1774  		 * addressable.
3a379bbcea0af6 Boris Brezillon    2017-07-19  1775  		 */
cc3a392d69b62e Parshuram Thombare 2020-08-25  1776  
cc3a392d69b62e Parshuram Thombare 2020-08-25  1777  		if (i3cboardinfo->static_addr)
cc3a392d69b62e Parshuram Thombare 2020-08-25  1778  			i3c_master_early_i3c_dev_add(master, i3cboardinfo);
cc3a392d69b62e Parshuram Thombare 2020-08-25  1779  	}
3a379bbcea0af6 Boris Brezillon    2017-07-19  1780  
3a379bbcea0af6 Boris Brezillon    2017-07-19  1781  	ret = i3c_master_do_daa(master);
3a379bbcea0af6 Boris Brezillon    2017-07-19  1782  	if (ret)
3a379bbcea0af6 Boris Brezillon    2017-07-19  1783  		goto err_rstdaa;
3a379bbcea0af6 Boris Brezillon    2017-07-19  1784  
3a379bbcea0af6 Boris Brezillon    2017-07-19  1785  	return 0;
3a379bbcea0af6 Boris Brezillon    2017-07-19  1786  
3a379bbcea0af6 Boris Brezillon    2017-07-19  1787  err_rstdaa:
3a379bbcea0af6 Boris Brezillon    2017-07-19  1788  	i3c_master_rstdaa_locked(master, I3C_BROADCAST_ADDR);
3a379bbcea0af6 Boris Brezillon    2017-07-19  1789  
3a379bbcea0af6 Boris Brezillon    2017-07-19  1790  err_bus_cleanup:
3a379bbcea0af6 Boris Brezillon    2017-07-19  1791  	if (master->ops->bus_cleanup)
3a379bbcea0af6 Boris Brezillon    2017-07-19  1792  		master->ops->bus_cleanup(master);
3a379bbcea0af6 Boris Brezillon    2017-07-19  1793  
3a379bbcea0af6 Boris Brezillon    2017-07-19  1794  err_detach_devs:
3a379bbcea0af6 Boris Brezillon    2017-07-19  1795  	i3c_master_detach_free_devs(master);
3a379bbcea0af6 Boris Brezillon    2017-07-19  1796  
3a379bbcea0af6 Boris Brezillon    2017-07-19  1797  	return ret;
3a379bbcea0af6 Boris Brezillon    2017-07-19  1798  }
3a379bbcea0af6 Boris Brezillon    2017-07-19  1799  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 34628 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v9 2/7] i3c: master: use i3c_master_register only for main master
  2020-11-29 14:22   ` Parshuram Thombare
  (?)
@ 2020-11-29 17:12     ` kernel test robot
  -1 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2020-11-29 17:12 UTC (permalink / raw)
  To: Parshuram Thombare, alexandre.belloni, slongerbeam, vitor.soares
  Cc: kbuild-all, linux-i3c, linux-kernel, mparab, praneeth,
	Parshuram Thombare

[-- Attachment #1: Type: text/plain, Size: 4271 bytes --]

Hi Parshuram,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on next-20201127]
[cannot apply to linus/master v5.10-rc5 v5.10-rc4 v5.10-rc3 v5.10-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Parshuram-Thombare/I3C-mastership-handover-support/20201129-222847
base:    6174f05255e65622ff3340257879a4c0f858b0df
config: i386-randconfig-a012-20201129 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/963007469aa0a76446a899aa8b019802dfc82cb6
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Parshuram-Thombare/I3C-mastership-handover-support/20201129-222847
        git checkout 963007469aa0a76446a899aa8b019802dfc82cb6
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/i3c/master/mipi-i3c-hci/core.c: In function 'i3c_hci_probe':
>> drivers/i3c/master/mipi-i3c-hci/core.c:760:8: error: implicit declaration of function 'i3c_master_register'; did you mean 'i3c_master_unregister'? [-Werror=implicit-function-declaration]
     760 |  ret = i3c_master_register(&hci->master, &pdev->dev,
         |        ^~~~~~~~~~~~~~~~~~~
         |        i3c_master_unregister
   cc1: some warnings being treated as errors

vim +760 drivers/i3c/master/mipi-i3c-hci/core.c

9ad9a52cce2828d Nicolas Pitre 2020-11-11  733  
9ad9a52cce2828d Nicolas Pitre 2020-11-11  734  static int i3c_hci_probe(struct platform_device *pdev)
9ad9a52cce2828d Nicolas Pitre 2020-11-11  735  {
9ad9a52cce2828d Nicolas Pitre 2020-11-11  736  	struct i3c_hci *hci;
9ad9a52cce2828d Nicolas Pitre 2020-11-11  737  	int irq, ret;
9ad9a52cce2828d Nicolas Pitre 2020-11-11  738  
9ad9a52cce2828d Nicolas Pitre 2020-11-11  739  	hci = devm_kzalloc(&pdev->dev, sizeof(*hci), GFP_KERNEL);
9ad9a52cce2828d Nicolas Pitre 2020-11-11  740  	if (!hci)
9ad9a52cce2828d Nicolas Pitre 2020-11-11  741  		return -ENOMEM;
9ad9a52cce2828d Nicolas Pitre 2020-11-11  742  	hci->base_regs = devm_platform_ioremap_resource(pdev, 0);
9ad9a52cce2828d Nicolas Pitre 2020-11-11  743  	if (IS_ERR(hci->base_regs))
9ad9a52cce2828d Nicolas Pitre 2020-11-11  744  		return PTR_ERR(hci->base_regs);
9ad9a52cce2828d Nicolas Pitre 2020-11-11  745  
9ad9a52cce2828d Nicolas Pitre 2020-11-11  746  	platform_set_drvdata(pdev, hci);
9ad9a52cce2828d Nicolas Pitre 2020-11-11  747  	/* temporary for dev_printk's, to be replaced in i3c_master_register */
9ad9a52cce2828d Nicolas Pitre 2020-11-11  748  	hci->master.dev.init_name = dev_name(&pdev->dev);
9ad9a52cce2828d Nicolas Pitre 2020-11-11  749  
9ad9a52cce2828d Nicolas Pitre 2020-11-11  750  	ret = i3c_hci_init(hci);
9ad9a52cce2828d Nicolas Pitre 2020-11-11  751  	if (ret)
9ad9a52cce2828d Nicolas Pitre 2020-11-11  752  		return ret;
9ad9a52cce2828d Nicolas Pitre 2020-11-11  753  
9ad9a52cce2828d Nicolas Pitre 2020-11-11  754  	irq = platform_get_irq(pdev, 0);
9ad9a52cce2828d Nicolas Pitre 2020-11-11  755  	ret = devm_request_irq(&pdev->dev, irq, i3c_hci_irq_handler,
9ad9a52cce2828d Nicolas Pitre 2020-11-11  756  			       0, NULL, hci);
9ad9a52cce2828d Nicolas Pitre 2020-11-11  757  	if (ret)
9ad9a52cce2828d Nicolas Pitre 2020-11-11  758  		return ret;
9ad9a52cce2828d Nicolas Pitre 2020-11-11  759  
9ad9a52cce2828d Nicolas Pitre 2020-11-11 @760  	ret = i3c_master_register(&hci->master, &pdev->dev,
9ad9a52cce2828d Nicolas Pitre 2020-11-11  761  				  &i3c_hci_ops, false);
9ad9a52cce2828d Nicolas Pitre 2020-11-11  762  	if (ret)
9ad9a52cce2828d Nicolas Pitre 2020-11-11  763  		return ret;
9ad9a52cce2828d Nicolas Pitre 2020-11-11  764  
9ad9a52cce2828d Nicolas Pitre 2020-11-11  765  	return 0;
9ad9a52cce2828d Nicolas Pitre 2020-11-11  766  }
9ad9a52cce2828d Nicolas Pitre 2020-11-11  767  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30185 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v9 2/7] i3c: master: use i3c_master_register only for main master
@ 2020-11-29 17:12     ` kernel test robot
  0 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2020-11-29 17:12 UTC (permalink / raw)
  To: Parshuram Thombare, alexandre.belloni, slongerbeam, vitor.soares
  Cc: mparab, kbuild-all, Parshuram Thombare, praneeth, linux-kernel,
	linux-i3c

[-- Attachment #1: Type: text/plain, Size: 4271 bytes --]

Hi Parshuram,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on next-20201127]
[cannot apply to linus/master v5.10-rc5 v5.10-rc4 v5.10-rc3 v5.10-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Parshuram-Thombare/I3C-mastership-handover-support/20201129-222847
base:    6174f05255e65622ff3340257879a4c0f858b0df
config: i386-randconfig-a012-20201129 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/963007469aa0a76446a899aa8b019802dfc82cb6
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Parshuram-Thombare/I3C-mastership-handover-support/20201129-222847
        git checkout 963007469aa0a76446a899aa8b019802dfc82cb6
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/i3c/master/mipi-i3c-hci/core.c: In function 'i3c_hci_probe':
>> drivers/i3c/master/mipi-i3c-hci/core.c:760:8: error: implicit declaration of function 'i3c_master_register'; did you mean 'i3c_master_unregister'? [-Werror=implicit-function-declaration]
     760 |  ret = i3c_master_register(&hci->master, &pdev->dev,
         |        ^~~~~~~~~~~~~~~~~~~
         |        i3c_master_unregister
   cc1: some warnings being treated as errors

vim +760 drivers/i3c/master/mipi-i3c-hci/core.c

9ad9a52cce2828d Nicolas Pitre 2020-11-11  733  
9ad9a52cce2828d Nicolas Pitre 2020-11-11  734  static int i3c_hci_probe(struct platform_device *pdev)
9ad9a52cce2828d Nicolas Pitre 2020-11-11  735  {
9ad9a52cce2828d Nicolas Pitre 2020-11-11  736  	struct i3c_hci *hci;
9ad9a52cce2828d Nicolas Pitre 2020-11-11  737  	int irq, ret;
9ad9a52cce2828d Nicolas Pitre 2020-11-11  738  
9ad9a52cce2828d Nicolas Pitre 2020-11-11  739  	hci = devm_kzalloc(&pdev->dev, sizeof(*hci), GFP_KERNEL);
9ad9a52cce2828d Nicolas Pitre 2020-11-11  740  	if (!hci)
9ad9a52cce2828d Nicolas Pitre 2020-11-11  741  		return -ENOMEM;
9ad9a52cce2828d Nicolas Pitre 2020-11-11  742  	hci->base_regs = devm_platform_ioremap_resource(pdev, 0);
9ad9a52cce2828d Nicolas Pitre 2020-11-11  743  	if (IS_ERR(hci->base_regs))
9ad9a52cce2828d Nicolas Pitre 2020-11-11  744  		return PTR_ERR(hci->base_regs);
9ad9a52cce2828d Nicolas Pitre 2020-11-11  745  
9ad9a52cce2828d Nicolas Pitre 2020-11-11  746  	platform_set_drvdata(pdev, hci);
9ad9a52cce2828d Nicolas Pitre 2020-11-11  747  	/* temporary for dev_printk's, to be replaced in i3c_master_register */
9ad9a52cce2828d Nicolas Pitre 2020-11-11  748  	hci->master.dev.init_name = dev_name(&pdev->dev);
9ad9a52cce2828d Nicolas Pitre 2020-11-11  749  
9ad9a52cce2828d Nicolas Pitre 2020-11-11  750  	ret = i3c_hci_init(hci);
9ad9a52cce2828d Nicolas Pitre 2020-11-11  751  	if (ret)
9ad9a52cce2828d Nicolas Pitre 2020-11-11  752  		return ret;
9ad9a52cce2828d Nicolas Pitre 2020-11-11  753  
9ad9a52cce2828d Nicolas Pitre 2020-11-11  754  	irq = platform_get_irq(pdev, 0);
9ad9a52cce2828d Nicolas Pitre 2020-11-11  755  	ret = devm_request_irq(&pdev->dev, irq, i3c_hci_irq_handler,
9ad9a52cce2828d Nicolas Pitre 2020-11-11  756  			       0, NULL, hci);
9ad9a52cce2828d Nicolas Pitre 2020-11-11  757  	if (ret)
9ad9a52cce2828d Nicolas Pitre 2020-11-11  758  		return ret;
9ad9a52cce2828d Nicolas Pitre 2020-11-11  759  
9ad9a52cce2828d Nicolas Pitre 2020-11-11 @760  	ret = i3c_master_register(&hci->master, &pdev->dev,
9ad9a52cce2828d Nicolas Pitre 2020-11-11  761  				  &i3c_hci_ops, false);
9ad9a52cce2828d Nicolas Pitre 2020-11-11  762  	if (ret)
9ad9a52cce2828d Nicolas Pitre 2020-11-11  763  		return ret;
9ad9a52cce2828d Nicolas Pitre 2020-11-11  764  
9ad9a52cce2828d Nicolas Pitre 2020-11-11  765  	return 0;
9ad9a52cce2828d Nicolas Pitre 2020-11-11  766  }
9ad9a52cce2828d Nicolas Pitre 2020-11-11  767  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30185 bytes --]

[-- Attachment #3: Type: text/plain, Size: 111 bytes --]

-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v9 2/7] i3c: master: use i3c_master_register only for main master
@ 2020-11-29 17:12     ` kernel test robot
  0 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2020-11-29 17:12 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4348 bytes --]

Hi Parshuram,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on next-20201127]
[cannot apply to linus/master v5.10-rc5 v5.10-rc4 v5.10-rc3 v5.10-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Parshuram-Thombare/I3C-mastership-handover-support/20201129-222847
base:    6174f05255e65622ff3340257879a4c0f858b0df
config: i386-randconfig-a012-20201129 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/963007469aa0a76446a899aa8b019802dfc82cb6
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Parshuram-Thombare/I3C-mastership-handover-support/20201129-222847
        git checkout 963007469aa0a76446a899aa8b019802dfc82cb6
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/i3c/master/mipi-i3c-hci/core.c: In function 'i3c_hci_probe':
>> drivers/i3c/master/mipi-i3c-hci/core.c:760:8: error: implicit declaration of function 'i3c_master_register'; did you mean 'i3c_master_unregister'? [-Werror=implicit-function-declaration]
     760 |  ret = i3c_master_register(&hci->master, &pdev->dev,
         |        ^~~~~~~~~~~~~~~~~~~
         |        i3c_master_unregister
   cc1: some warnings being treated as errors

vim +760 drivers/i3c/master/mipi-i3c-hci/core.c

9ad9a52cce2828d Nicolas Pitre 2020-11-11  733  
9ad9a52cce2828d Nicolas Pitre 2020-11-11  734  static int i3c_hci_probe(struct platform_device *pdev)
9ad9a52cce2828d Nicolas Pitre 2020-11-11  735  {
9ad9a52cce2828d Nicolas Pitre 2020-11-11  736  	struct i3c_hci *hci;
9ad9a52cce2828d Nicolas Pitre 2020-11-11  737  	int irq, ret;
9ad9a52cce2828d Nicolas Pitre 2020-11-11  738  
9ad9a52cce2828d Nicolas Pitre 2020-11-11  739  	hci = devm_kzalloc(&pdev->dev, sizeof(*hci), GFP_KERNEL);
9ad9a52cce2828d Nicolas Pitre 2020-11-11  740  	if (!hci)
9ad9a52cce2828d Nicolas Pitre 2020-11-11  741  		return -ENOMEM;
9ad9a52cce2828d Nicolas Pitre 2020-11-11  742  	hci->base_regs = devm_platform_ioremap_resource(pdev, 0);
9ad9a52cce2828d Nicolas Pitre 2020-11-11  743  	if (IS_ERR(hci->base_regs))
9ad9a52cce2828d Nicolas Pitre 2020-11-11  744  		return PTR_ERR(hci->base_regs);
9ad9a52cce2828d Nicolas Pitre 2020-11-11  745  
9ad9a52cce2828d Nicolas Pitre 2020-11-11  746  	platform_set_drvdata(pdev, hci);
9ad9a52cce2828d Nicolas Pitre 2020-11-11  747  	/* temporary for dev_printk's, to be replaced in i3c_master_register */
9ad9a52cce2828d Nicolas Pitre 2020-11-11  748  	hci->master.dev.init_name = dev_name(&pdev->dev);
9ad9a52cce2828d Nicolas Pitre 2020-11-11  749  
9ad9a52cce2828d Nicolas Pitre 2020-11-11  750  	ret = i3c_hci_init(hci);
9ad9a52cce2828d Nicolas Pitre 2020-11-11  751  	if (ret)
9ad9a52cce2828d Nicolas Pitre 2020-11-11  752  		return ret;
9ad9a52cce2828d Nicolas Pitre 2020-11-11  753  
9ad9a52cce2828d Nicolas Pitre 2020-11-11  754  	irq = platform_get_irq(pdev, 0);
9ad9a52cce2828d Nicolas Pitre 2020-11-11  755  	ret = devm_request_irq(&pdev->dev, irq, i3c_hci_irq_handler,
9ad9a52cce2828d Nicolas Pitre 2020-11-11  756  			       0, NULL, hci);
9ad9a52cce2828d Nicolas Pitre 2020-11-11  757  	if (ret)
9ad9a52cce2828d Nicolas Pitre 2020-11-11  758  		return ret;
9ad9a52cce2828d Nicolas Pitre 2020-11-11  759  
9ad9a52cce2828d Nicolas Pitre 2020-11-11 @760  	ret = i3c_master_register(&hci->master, &pdev->dev,
9ad9a52cce2828d Nicolas Pitre 2020-11-11  761  				  &i3c_hci_ops, false);
9ad9a52cce2828d Nicolas Pitre 2020-11-11  762  	if (ret)
9ad9a52cce2828d Nicolas Pitre 2020-11-11  763  		return ret;
9ad9a52cce2828d Nicolas Pitre 2020-11-11  764  
9ad9a52cce2828d Nicolas Pitre 2020-11-11  765  	return 0;
9ad9a52cce2828d Nicolas Pitre 2020-11-11  766  }
9ad9a52cce2828d Nicolas Pitre 2020-11-11  767  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 30185 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v9 2/7] i3c: master: use i3c_master_register only for main master
  2020-11-29 14:19 [RESEND PATCH v9 0/7] I3C mastership handover support Parshuram Thombare
@ 2020-11-29 14:22   ` Parshuram Thombare
  0 siblings, 0 replies; 8+ messages in thread
From: Parshuram Thombare @ 2020-11-29 14:22 UTC (permalink / raw)
  To: alexandre.belloni, slongerbeam, vitor.soares
  Cc: linux-i3c, linux-kernel, mparab, praneeth, Parshuram Thombare

Removed last argument 'secondary' and restructured
i3c_master_register to move code that can be common
to i3c_secondary_master_register to separate function
i3c_master_init.

Signed-off-by: Parshuram Thombare <pthombar@cadence.com>
---
 drivers/i3c/master.c                 |   78 ++++++++++++++++++++-------------
 drivers/i3c/master/dw-i3c-master.c   |    4 +-
 drivers/i3c/master/i3c-master-cdns.c |    4 +-
 include/linux/i3c/master.h           |    7 +--
 4 files changed, 54 insertions(+), 39 deletions(-)

diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index b61bf53..56e8fe4 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -1637,7 +1637,7 @@ static void i3c_master_detach_free_devs(struct i3c_master_controller *master)
 }
 
 /**
- * i3c_master_bus_init() - initialize an I3C bus
+ * i3c_primary_master_bus_init() - initialize an I3C bus
  * @master: main master initializing the bus
  *
  * This function is following all initialisation steps described in the I3C
@@ -1668,7 +1668,7 @@ static void i3c_master_detach_free_devs(struct i3c_master_controller *master)
  *
  * Return: a 0 in case of success, an negative error code otherwise.
  */
-static int i3c_master_bus_init(struct i3c_master_controller *master)
+static int i3c_primary_master_bus_init(struct i3c_master_controller *master)
 {
 	enum i3c_addr_slot_status status;
 	struct i2c_dev_boardinfo *i2cboardinfo;
@@ -2441,31 +2441,10 @@ static int i3c_master_check_ops(const struct i3c_master_controller_ops *ops)
 	return 0;
 }
 
-/**
- * i3c_master_register() - register an I3C master
- * @master: master used to send frames on the bus
- * @parent: the parent device (the one that provides this I3C master
- *	    controller)
- * @ops: the master controller operations
- * @secondary: true if you are registering a secondary master. Will return
- *	       -ENOTSUPP if set to true since secondary masters are not yet
- *	       supported
- *
- * This function takes care of everything for you:
- *
- * - creates and initializes the I3C bus
- * - populates the bus with static I2C devs if @parent->of_node is not
- *   NULL
- * - registers all I3C devices added by the controller during bus
- *   initialization
- * - registers the I2C adapter and all I2C devices
- *
- * Return: 0 in case of success, a negative error code otherwise.
- */
-int i3c_master_register(struct i3c_master_controller *master,
-			struct device *parent,
-			const struct i3c_master_controller_ops *ops,
-			bool secondary)
+static int i3c_master_init(struct i3c_master_controller *master,
+			   struct device *parent,
+			   const struct i3c_master_controller_ops *ops,
+			   bool secondary)
 {
 	unsigned long i2c_scl_rate = I3C_BUS_I2C_FM_PLUS_SCL_RATE;
 	struct i3c_bus *i3cbus = i3c_master_get_bus(master);
@@ -2535,10 +2514,49 @@ int i3c_master_register(struct i3c_master_controller *master,
 		goto err_put_dev;
 	}
 
-	ret = i3c_master_bus_init(master);
+	ret = i3c_primary_master_bus_init(master);
 	if (ret)
 		goto err_destroy_wq;
 
+	return 0;
+
+err_destroy_wq:
+	destroy_workqueue(master->wq);
+
+err_put_dev:
+	put_device(&master->dev);
+
+	return ret;
+}
+
+/**
+ * i3c_primary_master_register() - register an I3C master
+ * @master: master used to send frames on the bus
+ * @parent: the parent device (the one that provides this I3C master
+ *	    controller)
+ * @ops: the master controller operations
+ *
+ * This function takes care of everything for you:
+ *
+ * - creates and initializes the I3C bus
+ * - populates the bus with static I2C devs if @parent->of_node is not
+ *   NULL
+ * - registers all I3C devices added by the controller during bus
+ *   initialization
+ * - registers the I2C adapter and all I2C devices
+ *
+ * Return: 0 in case of success, a negative error code otherwise.
+ */
+int i3c_primary_master_register(struct i3c_master_controller *master,
+				struct device *parent,
+				const struct i3c_master_controller_ops *ops)
+{
+	int ret;
+
+	ret = i3c_master_init(master, parent, ops, false);
+	if (ret)
+		return ret;
+
 	ret = device_add(&master->dev);
 	if (ret)
 		goto err_cleanup_bus;
@@ -2568,15 +2586,13 @@ int i3c_master_register(struct i3c_master_controller *master,
 err_cleanup_bus:
 	i3c_master_bus_cleanup(master);
 
-err_destroy_wq:
 	destroy_workqueue(master->wq);
 
-err_put_dev:
 	put_device(&master->dev);
 
 	return ret;
 }
-EXPORT_SYMBOL_GPL(i3c_master_register);
+EXPORT_SYMBOL_GPL(i3c_primary_master_register);
 
 /**
  * i3c_master_unregister() - unregister an I3C master
diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
index 8513bd3..4f4d41f 100644
--- a/drivers/i3c/master/dw-i3c-master.c
+++ b/drivers/i3c/master/dw-i3c-master.c
@@ -1166,8 +1166,8 @@ static int dw_i3c_probe(struct platform_device *pdev)
 	master->maxdevs = ret >> 16;
 	master->free_pos = GENMASK(master->maxdevs - 1, 0);
 
-	ret = i3c_master_register(&master->base, &pdev->dev,
-				  &dw_mipi_i3c_ops, false);
+	ret = i3c_primary_master_register(&master->base, &pdev->dev,
+					  &dw_mipi_i3c_ops);
 	if (ret)
 		goto err_assert_rst;
 
diff --git a/drivers/i3c/master/i3c-master-cdns.c b/drivers/i3c/master/i3c-master-cdns.c
index 3f22269..f1d6d68 100644
--- a/drivers/i3c/master/i3c-master-cdns.c
+++ b/drivers/i3c/master/i3c-master-cdns.c
@@ -1644,8 +1644,8 @@ static int cdns_i3c_master_probe(struct platform_device *pdev)
 	writel(MST_INT_IBIR_THR, master->regs + MST_IER);
 	writel(DEVS_CTRL_DEV_CLR_ALL, master->regs + DEVS_CTRL);
 
-	ret = i3c_master_register(&master->base, &pdev->dev,
-				  &cdns_i3c_master_ops, false);
+	ret = i3c_primary_master_register(&master->base, &pdev->dev,
+					  &cdns_i3c_master_ops);
 	if (ret)
 		goto err_disable_sysclk;
 
diff --git a/include/linux/i3c/master.h b/include/linux/i3c/master.h
index 9cb39d9..e543f68 100644
--- a/include/linux/i3c/master.h
+++ b/include/linux/i3c/master.h
@@ -538,10 +538,9 @@ int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master,
 int i3c_master_set_info(struct i3c_master_controller *master,
 			const struct i3c_device_info *info);
 
-int i3c_master_register(struct i3c_master_controller *master,
-			struct device *parent,
-			const struct i3c_master_controller_ops *ops,
-			bool secondary);
+int i3c_primary_master_register(struct i3c_master_controller *master,
+				struct device *parent,
+				const struct i3c_master_controller_ops *ops);
 int i3c_master_unregister(struct i3c_master_controller *master);
 
 /**
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v9 2/7] i3c: master: use i3c_master_register only for main master
@ 2020-11-29 14:22   ` Parshuram Thombare
  0 siblings, 0 replies; 8+ messages in thread
From: Parshuram Thombare @ 2020-11-29 14:22 UTC (permalink / raw)
  To: alexandre.belloni, slongerbeam, vitor.soares
  Cc: praneeth, mparab, linux-i3c, linux-kernel, Parshuram Thombare

Removed last argument 'secondary' and restructured
i3c_master_register to move code that can be common
to i3c_secondary_master_register to separate function
i3c_master_init.

Signed-off-by: Parshuram Thombare <pthombar@cadence.com>
---
 drivers/i3c/master.c                 |   78 ++++++++++++++++++++-------------
 drivers/i3c/master/dw-i3c-master.c   |    4 +-
 drivers/i3c/master/i3c-master-cdns.c |    4 +-
 include/linux/i3c/master.h           |    7 +--
 4 files changed, 54 insertions(+), 39 deletions(-)

diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index b61bf53..56e8fe4 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -1637,7 +1637,7 @@ static void i3c_master_detach_free_devs(struct i3c_master_controller *master)
 }
 
 /**
- * i3c_master_bus_init() - initialize an I3C bus
+ * i3c_primary_master_bus_init() - initialize an I3C bus
  * @master: main master initializing the bus
  *
  * This function is following all initialisation steps described in the I3C
@@ -1668,7 +1668,7 @@ static void i3c_master_detach_free_devs(struct i3c_master_controller *master)
  *
  * Return: a 0 in case of success, an negative error code otherwise.
  */
-static int i3c_master_bus_init(struct i3c_master_controller *master)
+static int i3c_primary_master_bus_init(struct i3c_master_controller *master)
 {
 	enum i3c_addr_slot_status status;
 	struct i2c_dev_boardinfo *i2cboardinfo;
@@ -2441,31 +2441,10 @@ static int i3c_master_check_ops(const struct i3c_master_controller_ops *ops)
 	return 0;
 }
 
-/**
- * i3c_master_register() - register an I3C master
- * @master: master used to send frames on the bus
- * @parent: the parent device (the one that provides this I3C master
- *	    controller)
- * @ops: the master controller operations
- * @secondary: true if you are registering a secondary master. Will return
- *	       -ENOTSUPP if set to true since secondary masters are not yet
- *	       supported
- *
- * This function takes care of everything for you:
- *
- * - creates and initializes the I3C bus
- * - populates the bus with static I2C devs if @parent->of_node is not
- *   NULL
- * - registers all I3C devices added by the controller during bus
- *   initialization
- * - registers the I2C adapter and all I2C devices
- *
- * Return: 0 in case of success, a negative error code otherwise.
- */
-int i3c_master_register(struct i3c_master_controller *master,
-			struct device *parent,
-			const struct i3c_master_controller_ops *ops,
-			bool secondary)
+static int i3c_master_init(struct i3c_master_controller *master,
+			   struct device *parent,
+			   const struct i3c_master_controller_ops *ops,
+			   bool secondary)
 {
 	unsigned long i2c_scl_rate = I3C_BUS_I2C_FM_PLUS_SCL_RATE;
 	struct i3c_bus *i3cbus = i3c_master_get_bus(master);
@@ -2535,10 +2514,49 @@ int i3c_master_register(struct i3c_master_controller *master,
 		goto err_put_dev;
 	}
 
-	ret = i3c_master_bus_init(master);
+	ret = i3c_primary_master_bus_init(master);
 	if (ret)
 		goto err_destroy_wq;
 
+	return 0;
+
+err_destroy_wq:
+	destroy_workqueue(master->wq);
+
+err_put_dev:
+	put_device(&master->dev);
+
+	return ret;
+}
+
+/**
+ * i3c_primary_master_register() - register an I3C master
+ * @master: master used to send frames on the bus
+ * @parent: the parent device (the one that provides this I3C master
+ *	    controller)
+ * @ops: the master controller operations
+ *
+ * This function takes care of everything for you:
+ *
+ * - creates and initializes the I3C bus
+ * - populates the bus with static I2C devs if @parent->of_node is not
+ *   NULL
+ * - registers all I3C devices added by the controller during bus
+ *   initialization
+ * - registers the I2C adapter and all I2C devices
+ *
+ * Return: 0 in case of success, a negative error code otherwise.
+ */
+int i3c_primary_master_register(struct i3c_master_controller *master,
+				struct device *parent,
+				const struct i3c_master_controller_ops *ops)
+{
+	int ret;
+
+	ret = i3c_master_init(master, parent, ops, false);
+	if (ret)
+		return ret;
+
 	ret = device_add(&master->dev);
 	if (ret)
 		goto err_cleanup_bus;
@@ -2568,15 +2586,13 @@ int i3c_master_register(struct i3c_master_controller *master,
 err_cleanup_bus:
 	i3c_master_bus_cleanup(master);
 
-err_destroy_wq:
 	destroy_workqueue(master->wq);
 
-err_put_dev:
 	put_device(&master->dev);
 
 	return ret;
 }
-EXPORT_SYMBOL_GPL(i3c_master_register);
+EXPORT_SYMBOL_GPL(i3c_primary_master_register);
 
 /**
  * i3c_master_unregister() - unregister an I3C master
diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
index 8513bd3..4f4d41f 100644
--- a/drivers/i3c/master/dw-i3c-master.c
+++ b/drivers/i3c/master/dw-i3c-master.c
@@ -1166,8 +1166,8 @@ static int dw_i3c_probe(struct platform_device *pdev)
 	master->maxdevs = ret >> 16;
 	master->free_pos = GENMASK(master->maxdevs - 1, 0);
 
-	ret = i3c_master_register(&master->base, &pdev->dev,
-				  &dw_mipi_i3c_ops, false);
+	ret = i3c_primary_master_register(&master->base, &pdev->dev,
+					  &dw_mipi_i3c_ops);
 	if (ret)
 		goto err_assert_rst;
 
diff --git a/drivers/i3c/master/i3c-master-cdns.c b/drivers/i3c/master/i3c-master-cdns.c
index 3f22269..f1d6d68 100644
--- a/drivers/i3c/master/i3c-master-cdns.c
+++ b/drivers/i3c/master/i3c-master-cdns.c
@@ -1644,8 +1644,8 @@ static int cdns_i3c_master_probe(struct platform_device *pdev)
 	writel(MST_INT_IBIR_THR, master->regs + MST_IER);
 	writel(DEVS_CTRL_DEV_CLR_ALL, master->regs + DEVS_CTRL);
 
-	ret = i3c_master_register(&master->base, &pdev->dev,
-				  &cdns_i3c_master_ops, false);
+	ret = i3c_primary_master_register(&master->base, &pdev->dev,
+					  &cdns_i3c_master_ops);
 	if (ret)
 		goto err_disable_sysclk;
 
diff --git a/include/linux/i3c/master.h b/include/linux/i3c/master.h
index 9cb39d9..e543f68 100644
--- a/include/linux/i3c/master.h
+++ b/include/linux/i3c/master.h
@@ -538,10 +538,9 @@ int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master,
 int i3c_master_set_info(struct i3c_master_controller *master,
 			const struct i3c_device_info *info);
 
-int i3c_master_register(struct i3c_master_controller *master,
-			struct device *parent,
-			const struct i3c_master_controller_ops *ops,
-			bool secondary);
+int i3c_primary_master_register(struct i3c_master_controller *master,
+				struct device *parent,
+				const struct i3c_master_controller_ops *ops);
 int i3c_master_unregister(struct i3c_master_controller *master);
 
 /**
-- 
1.7.1


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v9 2/7] i3c: master: use i3c_master_register only for main master
@ 2020-11-28 14:46 ` Parshuram Thombare
  0 siblings, 0 replies; 8+ messages in thread
From: Parshuram Thombare @ 2020-11-28 14:46 UTC (permalink / raw)
  To: alexandre.belloni, slongerbeam, vitor.soares
  Cc: linux-i3c, linux-kernel, mparab, praneeth, Parshuram Thombare

Removed last argument 'secondary' and restructured
i3c_master_register to move code that can be common
to i3c_secondary_master_register to separate function
i3c_master_init.

Signed-off-by: Parshuram Thombare <pthombar@cadence.com>
---
 drivers/i3c/master.c                 |   78 ++++++++++++++++++++-------------
 drivers/i3c/master/dw-i3c-master.c   |    4 +-
 drivers/i3c/master/i3c-master-cdns.c |    4 +-
 include/linux/i3c/master.h           |    7 +--
 4 files changed, 54 insertions(+), 39 deletions(-)

diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index b61bf53..56e8fe4 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -1637,7 +1637,7 @@ static void i3c_master_detach_free_devs(struct i3c_master_controller *master)
 }
 
 /**
- * i3c_master_bus_init() - initialize an I3C bus
+ * i3c_primary_master_bus_init() - initialize an I3C bus
  * @master: main master initializing the bus
  *
  * This function is following all initialisation steps described in the I3C
@@ -1668,7 +1668,7 @@ static void i3c_master_detach_free_devs(struct i3c_master_controller *master)
  *
  * Return: a 0 in case of success, an negative error code otherwise.
  */
-static int i3c_master_bus_init(struct i3c_master_controller *master)
+static int i3c_primary_master_bus_init(struct i3c_master_controller *master)
 {
 	enum i3c_addr_slot_status status;
 	struct i2c_dev_boardinfo *i2cboardinfo;
@@ -2441,31 +2441,10 @@ static int i3c_master_check_ops(const struct i3c_master_controller_ops *ops)
 	return 0;
 }
 
-/**
- * i3c_master_register() - register an I3C master
- * @master: master used to send frames on the bus
- * @parent: the parent device (the one that provides this I3C master
- *	    controller)
- * @ops: the master controller operations
- * @secondary: true if you are registering a secondary master. Will return
- *	       -ENOTSUPP if set to true since secondary masters are not yet
- *	       supported
- *
- * This function takes care of everything for you:
- *
- * - creates and initializes the I3C bus
- * - populates the bus with static I2C devs if @parent->of_node is not
- *   NULL
- * - registers all I3C devices added by the controller during bus
- *   initialization
- * - registers the I2C adapter and all I2C devices
- *
- * Return: 0 in case of success, a negative error code otherwise.
- */
-int i3c_master_register(struct i3c_master_controller *master,
-			struct device *parent,
-			const struct i3c_master_controller_ops *ops,
-			bool secondary)
+static int i3c_master_init(struct i3c_master_controller *master,
+			   struct device *parent,
+			   const struct i3c_master_controller_ops *ops,
+			   bool secondary)
 {
 	unsigned long i2c_scl_rate = I3C_BUS_I2C_FM_PLUS_SCL_RATE;
 	struct i3c_bus *i3cbus = i3c_master_get_bus(master);
@@ -2535,10 +2514,49 @@ int i3c_master_register(struct i3c_master_controller *master,
 		goto err_put_dev;
 	}
 
-	ret = i3c_master_bus_init(master);
+	ret = i3c_primary_master_bus_init(master);
 	if (ret)
 		goto err_destroy_wq;
 
+	return 0;
+
+err_destroy_wq:
+	destroy_workqueue(master->wq);
+
+err_put_dev:
+	put_device(&master->dev);
+
+	return ret;
+}
+
+/**
+ * i3c_primary_master_register() - register an I3C master
+ * @master: master used to send frames on the bus
+ * @parent: the parent device (the one that provides this I3C master
+ *	    controller)
+ * @ops: the master controller operations
+ *
+ * This function takes care of everything for you:
+ *
+ * - creates and initializes the I3C bus
+ * - populates the bus with static I2C devs if @parent->of_node is not
+ *   NULL
+ * - registers all I3C devices added by the controller during bus
+ *   initialization
+ * - registers the I2C adapter and all I2C devices
+ *
+ * Return: 0 in case of success, a negative error code otherwise.
+ */
+int i3c_primary_master_register(struct i3c_master_controller *master,
+				struct device *parent,
+				const struct i3c_master_controller_ops *ops)
+{
+	int ret;
+
+	ret = i3c_master_init(master, parent, ops, false);
+	if (ret)
+		return ret;
+
 	ret = device_add(&master->dev);
 	if (ret)
 		goto err_cleanup_bus;
@@ -2568,15 +2586,13 @@ int i3c_master_register(struct i3c_master_controller *master,
 err_cleanup_bus:
 	i3c_master_bus_cleanup(master);
 
-err_destroy_wq:
 	destroy_workqueue(master->wq);
 
-err_put_dev:
 	put_device(&master->dev);
 
 	return ret;
 }
-EXPORT_SYMBOL_GPL(i3c_master_register);
+EXPORT_SYMBOL_GPL(i3c_primary_master_register);
 
 /**
  * i3c_master_unregister() - unregister an I3C master
diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
index 8513bd3..4f4d41f 100644
--- a/drivers/i3c/master/dw-i3c-master.c
+++ b/drivers/i3c/master/dw-i3c-master.c
@@ -1166,8 +1166,8 @@ static int dw_i3c_probe(struct platform_device *pdev)
 	master->maxdevs = ret >> 16;
 	master->free_pos = GENMASK(master->maxdevs - 1, 0);
 
-	ret = i3c_master_register(&master->base, &pdev->dev,
-				  &dw_mipi_i3c_ops, false);
+	ret = i3c_primary_master_register(&master->base, &pdev->dev,
+					  &dw_mipi_i3c_ops);
 	if (ret)
 		goto err_assert_rst;
 
diff --git a/drivers/i3c/master/i3c-master-cdns.c b/drivers/i3c/master/i3c-master-cdns.c
index 3f22269..f1d6d68 100644
--- a/drivers/i3c/master/i3c-master-cdns.c
+++ b/drivers/i3c/master/i3c-master-cdns.c
@@ -1644,8 +1644,8 @@ static int cdns_i3c_master_probe(struct platform_device *pdev)
 	writel(MST_INT_IBIR_THR, master->regs + MST_IER);
 	writel(DEVS_CTRL_DEV_CLR_ALL, master->regs + DEVS_CTRL);
 
-	ret = i3c_master_register(&master->base, &pdev->dev,
-				  &cdns_i3c_master_ops, false);
+	ret = i3c_primary_master_register(&master->base, &pdev->dev,
+					  &cdns_i3c_master_ops);
 	if (ret)
 		goto err_disable_sysclk;
 
diff --git a/include/linux/i3c/master.h b/include/linux/i3c/master.h
index 9cb39d9..e543f68 100644
--- a/include/linux/i3c/master.h
+++ b/include/linux/i3c/master.h
@@ -538,10 +538,9 @@ int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master,
 int i3c_master_set_info(struct i3c_master_controller *master,
 			const struct i3c_device_info *info);
 
-int i3c_master_register(struct i3c_master_controller *master,
-			struct device *parent,
-			const struct i3c_master_controller_ops *ops,
-			bool secondary);
+int i3c_primary_master_register(struct i3c_master_controller *master,
+				struct device *parent,
+				const struct i3c_master_controller_ops *ops);
 int i3c_master_unregister(struct i3c_master_controller *master);
 
 /**
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v9 2/7] i3c: master: use i3c_master_register only for main master
@ 2020-11-28 14:46 ` Parshuram Thombare
  0 siblings, 0 replies; 8+ messages in thread
From: Parshuram Thombare @ 2020-11-28 14:46 UTC (permalink / raw)
  To: alexandre.belloni, slongerbeam, vitor.soares
  Cc: praneeth, mparab, linux-i3c, linux-kernel, Parshuram Thombare

Removed last argument 'secondary' and restructured
i3c_master_register to move code that can be common
to i3c_secondary_master_register to separate function
i3c_master_init.

Signed-off-by: Parshuram Thombare <pthombar@cadence.com>
---
 drivers/i3c/master.c                 |   78 ++++++++++++++++++++-------------
 drivers/i3c/master/dw-i3c-master.c   |    4 +-
 drivers/i3c/master/i3c-master-cdns.c |    4 +-
 include/linux/i3c/master.h           |    7 +--
 4 files changed, 54 insertions(+), 39 deletions(-)

diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index b61bf53..56e8fe4 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -1637,7 +1637,7 @@ static void i3c_master_detach_free_devs(struct i3c_master_controller *master)
 }
 
 /**
- * i3c_master_bus_init() - initialize an I3C bus
+ * i3c_primary_master_bus_init() - initialize an I3C bus
  * @master: main master initializing the bus
  *
  * This function is following all initialisation steps described in the I3C
@@ -1668,7 +1668,7 @@ static void i3c_master_detach_free_devs(struct i3c_master_controller *master)
  *
  * Return: a 0 in case of success, an negative error code otherwise.
  */
-static int i3c_master_bus_init(struct i3c_master_controller *master)
+static int i3c_primary_master_bus_init(struct i3c_master_controller *master)
 {
 	enum i3c_addr_slot_status status;
 	struct i2c_dev_boardinfo *i2cboardinfo;
@@ -2441,31 +2441,10 @@ static int i3c_master_check_ops(const struct i3c_master_controller_ops *ops)
 	return 0;
 }
 
-/**
- * i3c_master_register() - register an I3C master
- * @master: master used to send frames on the bus
- * @parent: the parent device (the one that provides this I3C master
- *	    controller)
- * @ops: the master controller operations
- * @secondary: true if you are registering a secondary master. Will return
- *	       -ENOTSUPP if set to true since secondary masters are not yet
- *	       supported
- *
- * This function takes care of everything for you:
- *
- * - creates and initializes the I3C bus
- * - populates the bus with static I2C devs if @parent->of_node is not
- *   NULL
- * - registers all I3C devices added by the controller during bus
- *   initialization
- * - registers the I2C adapter and all I2C devices
- *
- * Return: 0 in case of success, a negative error code otherwise.
- */
-int i3c_master_register(struct i3c_master_controller *master,
-			struct device *parent,
-			const struct i3c_master_controller_ops *ops,
-			bool secondary)
+static int i3c_master_init(struct i3c_master_controller *master,
+			   struct device *parent,
+			   const struct i3c_master_controller_ops *ops,
+			   bool secondary)
 {
 	unsigned long i2c_scl_rate = I3C_BUS_I2C_FM_PLUS_SCL_RATE;
 	struct i3c_bus *i3cbus = i3c_master_get_bus(master);
@@ -2535,10 +2514,49 @@ int i3c_master_register(struct i3c_master_controller *master,
 		goto err_put_dev;
 	}
 
-	ret = i3c_master_bus_init(master);
+	ret = i3c_primary_master_bus_init(master);
 	if (ret)
 		goto err_destroy_wq;
 
+	return 0;
+
+err_destroy_wq:
+	destroy_workqueue(master->wq);
+
+err_put_dev:
+	put_device(&master->dev);
+
+	return ret;
+}
+
+/**
+ * i3c_primary_master_register() - register an I3C master
+ * @master: master used to send frames on the bus
+ * @parent: the parent device (the one that provides this I3C master
+ *	    controller)
+ * @ops: the master controller operations
+ *
+ * This function takes care of everything for you:
+ *
+ * - creates and initializes the I3C bus
+ * - populates the bus with static I2C devs if @parent->of_node is not
+ *   NULL
+ * - registers all I3C devices added by the controller during bus
+ *   initialization
+ * - registers the I2C adapter and all I2C devices
+ *
+ * Return: 0 in case of success, a negative error code otherwise.
+ */
+int i3c_primary_master_register(struct i3c_master_controller *master,
+				struct device *parent,
+				const struct i3c_master_controller_ops *ops)
+{
+	int ret;
+
+	ret = i3c_master_init(master, parent, ops, false);
+	if (ret)
+		return ret;
+
 	ret = device_add(&master->dev);
 	if (ret)
 		goto err_cleanup_bus;
@@ -2568,15 +2586,13 @@ int i3c_master_register(struct i3c_master_controller *master,
 err_cleanup_bus:
 	i3c_master_bus_cleanup(master);
 
-err_destroy_wq:
 	destroy_workqueue(master->wq);
 
-err_put_dev:
 	put_device(&master->dev);
 
 	return ret;
 }
-EXPORT_SYMBOL_GPL(i3c_master_register);
+EXPORT_SYMBOL_GPL(i3c_primary_master_register);
 
 /**
  * i3c_master_unregister() - unregister an I3C master
diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
index 8513bd3..4f4d41f 100644
--- a/drivers/i3c/master/dw-i3c-master.c
+++ b/drivers/i3c/master/dw-i3c-master.c
@@ -1166,8 +1166,8 @@ static int dw_i3c_probe(struct platform_device *pdev)
 	master->maxdevs = ret >> 16;
 	master->free_pos = GENMASK(master->maxdevs - 1, 0);
 
-	ret = i3c_master_register(&master->base, &pdev->dev,
-				  &dw_mipi_i3c_ops, false);
+	ret = i3c_primary_master_register(&master->base, &pdev->dev,
+					  &dw_mipi_i3c_ops);
 	if (ret)
 		goto err_assert_rst;
 
diff --git a/drivers/i3c/master/i3c-master-cdns.c b/drivers/i3c/master/i3c-master-cdns.c
index 3f22269..f1d6d68 100644
--- a/drivers/i3c/master/i3c-master-cdns.c
+++ b/drivers/i3c/master/i3c-master-cdns.c
@@ -1644,8 +1644,8 @@ static int cdns_i3c_master_probe(struct platform_device *pdev)
 	writel(MST_INT_IBIR_THR, master->regs + MST_IER);
 	writel(DEVS_CTRL_DEV_CLR_ALL, master->regs + DEVS_CTRL);
 
-	ret = i3c_master_register(&master->base, &pdev->dev,
-				  &cdns_i3c_master_ops, false);
+	ret = i3c_primary_master_register(&master->base, &pdev->dev,
+					  &cdns_i3c_master_ops);
 	if (ret)
 		goto err_disable_sysclk;
 
diff --git a/include/linux/i3c/master.h b/include/linux/i3c/master.h
index 9cb39d9..e543f68 100644
--- a/include/linux/i3c/master.h
+++ b/include/linux/i3c/master.h
@@ -538,10 +538,9 @@ int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master,
 int i3c_master_set_info(struct i3c_master_controller *master,
 			const struct i3c_device_info *info);
 
-int i3c_master_register(struct i3c_master_controller *master,
-			struct device *parent,
-			const struct i3c_master_controller_ops *ops,
-			bool secondary);
+int i3c_primary_master_register(struct i3c_master_controller *master,
+				struct device *parent,
+				const struct i3c_master_controller_ops *ops);
 int i3c_master_unregister(struct i3c_master_controller *master);
 
 /**
-- 
1.7.1


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-12-01  7:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-29 17:12 [PATCH v9 2/7] i3c: master: use i3c_master_register only for main master kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2020-11-29 14:19 [RESEND PATCH v9 0/7] I3C mastership handover support Parshuram Thombare
2020-11-29 14:22 ` [PATCH v9 2/7] i3c: master: use i3c_master_register only for main master Parshuram Thombare
2020-11-29 14:22   ` Parshuram Thombare
2020-11-29 17:12   ` kernel test robot
2020-11-29 17:12     ` kernel test robot
2020-11-29 17:12     ` kernel test robot
2020-11-28 14:46 Parshuram Thombare
2020-11-28 14:46 ` Parshuram Thombare

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.