diff mbox

[RFC,v2,5/5] drm/dsi: Get DSI host by DT device node

Message ID 1444123482-25579-6-git-send-email-architt@codeaurora.org (mailing list archive)
State RFC
Delegated to: Andy Gross
Headers show

Commit Message

Archit Taneja Oct. 6, 2015, 9:24 a.m. UTC
mipi_dsi_devices are inherently aware of their host because they
share a parent-child hierarchy in the device tree.

Non-dsi drivers that create a dummy dsi device don't have this data.
In order to get this information, they require to a phandle to the dsi
host in the device tree.

Maintain a list of all the hosts DSI that are currently registered.

This list will be used to find the mipi_dsi_host corresponding to the
device_node passed in of_find_mipi_dsi_host_by_node.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
---
 drivers/gpu/drm/drm_mipi_dsi.c | 30 ++++++++++++++++++++++++++++++
 include/drm/drm_mipi_dsi.h     |  2 ++
 2 files changed, 32 insertions(+)

Comments

kernel test robot Oct. 6, 2015, 10 a.m. UTC | #1
Hi Archit,

[auto build test WARNING on v4.3-rc4 -- if it's inappropriate base, please ignore]

reproduce: make htmldocs

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/i915/i915_irq.c:491: warning: No description found for parameter 'dev'
   drivers/gpu/drm/i915/i915_irq.c:2217: warning: No description found for parameter 'dev'
   drivers/gpu/drm/i915/i915_irq.c:2397: warning: No description found for parameter 'wedged'
   drivers/gpu/drm/i915/i915_irq.c:2397: warning: No description found for parameter 'fmt'
   include/drm/drm_crtc.h:310: warning: No description found for parameter 'mode_blob'
   include/drm/drm_crtc.h:748: warning: No description found for parameter 'tile_blob_ptr'
   include/drm/drm_crtc.h:787: warning: No description found for parameter 'rotation'
   include/drm/drm_crtc.h:883: warning: No description found for parameter 'mutex'
   include/drm/drm_crtc.h:883: warning: No description found for parameter 'helper_private'
   include/drm/drm_crtc.h:931: warning: Excess struct/union/enum/typedef member 'base' description in 'drm_bridge'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'tile_idr'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'delayed_event'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'edid_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'dpms_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'path_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'tile_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'plane_type_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'rotation_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'prop_src_x'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'prop_src_y'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'prop_src_w'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'prop_src_h'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'prop_crtc_x'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'prop_crtc_y'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'prop_crtc_w'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'prop_crtc_h'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'prop_fb_id'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'prop_crtc_id'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'prop_active'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'prop_mode_id'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'dvi_i_subconnector_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'dvi_i_select_subconnector_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'tv_subconnector_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'tv_select_subconnector_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'tv_mode_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'tv_left_margin_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'tv_right_margin_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'tv_top_margin_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'tv_bottom_margin_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'tv_brightness_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'tv_contrast_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'tv_flicker_reduction_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'tv_overscan_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'tv_saturation_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'tv_hue_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'scaling_mode_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'aspect_ratio_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'dirty_info_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'suggested_x_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'suggested_y_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 'allow_fb_modifiers'
   Warning(include/drm/drm_modeset_lock.h:47): Incorrect use of kernel-doc format: 	 * Contended lock: if a lock is contended you should only call
   Warning(include/drm/drm_modeset_lock.h:54): Incorrect use of kernel-doc format: 	 * list of held locks (drm_modeset_lock)
   Warning(include/drm/drm_modeset_lock.h:59): Incorrect use of kernel-doc format: 	 * Trylock mode, use only for panic handlers!
   Warning(include/drm/drm_modeset_lock.h:74): Incorrect use of kernel-doc format: 	 * modeset lock
   Warning(include/drm/drm_modeset_lock.h:79): Incorrect use of kernel-doc format: 	 * Resources that are locked as part of an atomic update are added
   include/drm/drm_dp_helper.h:706: warning: No description found for parameter 'i2c_nack_count'
   include/drm/drm_dp_helper.h:706: warning: No description found for parameter 'i2c_defer_count'
   drivers/gpu/drm/drm_dp_mst_topology.c:2226: warning: No description found for parameter 'connector'
   include/drm/drm_dp_mst_helper.h:97: warning: No description found for parameter 'cached_edid'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'max_dpcd_transaction_bytes'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'sink_count'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'total_slots'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'avail_slots'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'total_pbn'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'qlock'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_msg_downq'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_msg_upq'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_down_in_progress'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_up_in_progress'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'payload_lock'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'proposed_vcpis'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'payloads'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'payload_mask'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'vcpi_mask'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_waitq'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'work'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_work'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'destroy_connector_list'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'destroy_connector_lock'
   include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'destroy_connector_work'
   drivers/gpu/drm/drm_dp_mst_topology.c:2226: warning: No description found for parameter 'connector'
>> include/drm/drm_mipi_dsi.h:104: warning: No description found for parameter 'list'
   include/drm/drmP.h:164: warning: No description found for parameter 'fmt'
   include/drm/drmP.h:180: warning: No description found for parameter 'fmt'
   include/drm/drmP.h:198: warning: No description found for parameter 'fmt'
   include/drm/drmP.h:238: warning: No description found for parameter 'dev'
   include/drm/drmP.h:238: warning: No description found for parameter 'data'
   include/drm/drmP.h:238: warning: No description found for parameter 'file_priv'
   include/drm/drmP.h:271: warning: No description found for parameter 'ioctl'
   include/drm/drmP.h:271: warning: No description found for parameter '_func'
   include/drm/drmP.h:271: warning: No description found for parameter '_flags'
   include/drm/drmP.h:344: warning: cannot understand function prototype: 'struct drm_lock_data '
   include/drm/drmP.h:397: warning: cannot understand function prototype: 'struct drm_driver '
   include/drm/drmP.h:646: warning: cannot understand function prototype: 'struct drm_info_list '
   include/drm/drmP.h:656: warning: cannot understand function prototype: 'struct drm_info_node '
   include/drm/drmP.h:666: warning: cannot understand function prototype: 'struct drm_minor '
   include/drm/drmP.h:712: warning: cannot understand function prototype: 'struct drm_device '
   drivers/gpu/drm/i915/i915_irq.c:491: warning: No description found for parameter 'dev'
   drivers/gpu/drm/i915/i915_irq.c:2217: warning: No description found for parameter 'dev'
   drivers/gpu/drm/i915/i915_irq.c:2397: warning: No description found for parameter 'wedged'
   drivers/gpu/drm/i915/i915_irq.c:2397: warning: No description found for parameter 'fmt'
   drivers/gpu/drm/i915/i915_irq.c:491: warning: No description found for parameter 'dev'
   drivers/gpu/drm/i915/i915_irq.c:2217: warning: No description found for parameter 'dev'
   drivers/gpu/drm/i915/i915_irq.c:2397: warning: No description found for parameter 'wedged'
   drivers/gpu/drm/i915/i915_irq.c:2397: warning: No description found for parameter 'fmt'
   drivers/gpu/drm/i915/i915_irq.c:491: warning: No description found for parameter 'dev'
   drivers/gpu/drm/i915/i915_irq.c:2217: warning: No description found for parameter 'dev'
   drivers/gpu/drm/i915/i915_irq.c:2397: warning: No description found for parameter 'wedged'
   drivers/gpu/drm/i915/i915_irq.c:2397: warning: No description found for parameter 'fmt'
   drivers/gpu/drm/i915/i915_irq.c:491: warning: No description found for parameter 'dev'
   drivers/gpu/drm/i915/i915_irq.c:2217: warning: No description found for parameter 'dev'
   drivers/gpu/drm/i915/i915_irq.c:2397: warning: No description found for parameter 'wedged'
   drivers/gpu/drm/i915/i915_irq.c:2397: warning: No description found for parameter 'fmt'
   drivers/gpu/drm/i915/i915_gem.c:421: warning: No description found for parameter 'dev'
   drivers/gpu/drm/i915/i915_gem.c:421: warning: No description found for parameter 'data'
   drivers/gpu/drm/i915/i915_gem.c:421: warning: No description found for parameter 'file'
   drivers/gpu/drm/i915/i915_gem.c:686: warning: No description found for parameter 'dev'
   drivers/gpu/drm/i915/i915_gem.c:686: warning: No description found for parameter 'data'
   drivers/gpu/drm/i915/i915_gem.c:686: warning: No description found for parameter 'file'
   drivers/gpu/drm/i915/i915_gem.c:767: warning: No description found for parameter 'dev'
   drivers/gpu/drm/i915/i915_gem.c:767: warning: No description found for parameter 'obj'
   drivers/gpu/drm/i915/i915_gem.c:767: warning: No description found for parameter 'args'
   drivers/gpu/drm/i915/i915_gem.c:767: warning: No description found for parameter 'file'
   drivers/gpu/drm/i915/i915_gem.c:1027: warning: No description found for parameter 'dev'
   drivers/gpu/drm/i915/i915_gem.c:1027: warning: No description found for parameter 'data'
   drivers/gpu/drm/i915/i915_gem.c:1027: warning: No description found for parameter 'file'
   drivers/gpu/drm/i915/i915_gem.c:1192: warning: No description found for parameter 'rps'
   drivers/gpu/drm/i915/i915_gem.c:1398: warning: No description found for parameter 'req'
   drivers/gpu/drm/i915/i915_gem.c:1433: warning: No description found for parameter 'obj'
   drivers/gpu/drm/i915/i915_gem.c:1433: warning: No description found for parameter 'readonly'
   drivers/gpu/drm/i915/i915_gem.c:1556: warning: No description found for parameter 'dev'
   drivers/gpu/drm/i915/i915_gem.c:1556: warning: No description found for parameter 'data'
   drivers/gpu/drm/i915/i915_gem.c:1556: warning: No description found for parameter 'file'
   drivers/gpu/drm/i915/i915_gem.c:1619: warning: No description found for parameter 'dev'
   drivers/gpu/drm/i915/i915_gem.c:1619: warning: No description found for parameter 'data'
   drivers/gpu/drm/i915/i915_gem.c:1619: warning: No description found for parameter 'file'
   drivers/gpu/drm/i915/i915_gem.c:1664: warning: No description found for parameter 'dev'
   drivers/gpu/drm/i915/i915_gem.c:1664: warning: No description found for parameter 'data'
   drivers/gpu/drm/i915/i915_gem.c:1664: warning: No description found for parameter 'file'
   drivers/gpu/drm/i915/i915_gem.c:1729: warning: No description found for parameter 'vma'
   drivers/gpu/drm/i915/i915_gem.c:1729: warning: No description found for parameter 'vmf'
   drivers/gpu/drm/i915/i915_gem.c:1952: warning: No description found for parameter 'dev'
   drivers/gpu/drm/i915/i915_gem.c:1952: warning: No description found for parameter 'size'
   drivers/gpu/drm/i915/i915_gem.c:1952: warning: No description found for parameter 'tiling_mode'
   drivers/gpu/drm/i915/i915_gem.c:1952: warning: No description found for parameter 'fenced'
   drivers/gpu/drm/i915/i915_gem.c:1952: warning: Excess function parameter 'obj' description in 'i915_gem_get_gtt_alignment'
   drivers/gpu/drm/i915/i915_gem.c:2815: warning: No description found for parameter 'ring'
   drivers/gpu/drm/i915/i915_gem.c:2944: warning: No description found for parameter 'obj'
   drivers/gpu/drm/i915/i915_gem.c:2994: warning: No description found for parameter 'dev'
   drivers/gpu/drm/i915/i915_gem.c:2994: warning: No description found for parameter 'data'
   drivers/gpu/drm/i915/i915_gem.c:2994: warning: No description found for parameter 'file'
   drivers/gpu/drm/i915/i915_gem.c:2994: warning: Excess function parameter 'DRM_IOCTL_ARGS' description in 'i915_gem_wait_ioctl'
   drivers/gpu/drm/i915/i915_gem.c:3355: warning: No description found for parameter 'obj'
   drivers/gpu/drm/i915/i915_gem.c:3355: warning: No description found for parameter 'vm'
   drivers/gpu/drm/i915/i915_gem.c:3355: warning: No description found for parameter 'ggtt_view'
   drivers/gpu/drm/i915/i915_gem.c:3355: warning: No description found for parameter 'alignment'
   drivers/gpu/drm/i915/i915_gem.c:3355: warning: No description found for parameter 'flags'
   drivers/gpu/drm/i915/i915_gem.c:3576: warning: No description found for parameter 'obj'
   drivers/gpu/drm/i915/i915_gem.c:3576: warning: No description found for parameter 'write'
   drivers/gpu/drm/i915/i915_gem.c:3858: warning: No description found for parameter 'obj'
   drivers/gpu/drm/i915/i915_gem.c:3858: warning: No description found for parameter 'write'
   drivers/gpu/drm/i915/i915_gem.c:4962: warning: No description found for parameter 'old'
   drivers/gpu/drm/i915/i915_gem.c:4962: warning: No description found for parameter 'new'
   drivers/gpu/drm/i915/i915_gem.c:4962: warning: No description found for parameter 'frontbuffer_bits'
   drivers/gpu/drm/i915/intel_lrc.c:782: warning: No description found for parameter 'req'
   drivers/gpu/drm/i915/intel_lrc.c:782: warning: Excess function parameter 'request' description in 'intel_logical_ring_begin'
   drivers/gpu/drm/i915/intel_lrc.c:782: warning: Excess function parameter 'ctx' description in 'intel_logical_ring_begin'
   drivers/gpu/drm/i915/intel_lrc.c:837: warning: No description found for parameter 'params'
   drivers/gpu/drm/i915/intel_lrc.c:837: warning: Excess function parameter 'dev' description in 'intel_execlists_submission'
   drivers/gpu/drm/i915/intel_lrc.c:837: warning: Excess function parameter 'file' description in 'intel_execlists_submission'
   drivers/gpu/drm/i915/intel_lrc.c:837: warning: Excess function parameter 'ring' description in 'intel_execlists_submission'
   drivers/gpu/drm/i915/intel_lrc.c:837: warning: Excess function parameter 'ctx' description in 'intel_execlists_submission'
   drivers/gpu/drm/i915/intel_lrc.c:837: warning: Excess function parameter 'batch_obj' description in 'intel_execlists_submission'
   drivers/gpu/drm/i915/intel_lrc.c:837: warning: Excess function parameter 'exec_start' description in 'intel_execlists_submission'
   drivers/gpu/drm/i915/intel_lrc.c:837: warning: Excess function parameter 'dispatch_flags' description in 'intel_execlists_submission'
   drivers/gpu/drm/i915/intel_lrc.c:782: warning: No description found for parameter 'req'
   drivers/gpu/drm/i915/intel_lrc.c:782: warning: Excess function parameter 'request' description in 'intel_logical_ring_begin'
   drivers/gpu/drm/i915/intel_lrc.c:782: warning: Excess function parameter 'ctx' description in 'intel_logical_ring_begin'
   drivers/gpu/drm/i915/intel_lrc.c:837: warning: No description found for parameter 'params'
   drivers/gpu/drm/i915/intel_lrc.c:837: warning: Excess function parameter 'dev' description in 'intel_execlists_submission'
   drivers/gpu/drm/i915/intel_lrc.c:837: warning: Excess function parameter 'file' description in 'intel_execlists_submission'
   drivers/gpu/drm/i915/intel_lrc.c:837: warning: Excess function parameter 'ring' description in 'intel_execlists_submission'

vim +/list +104 include/drm/drm_mipi_dsi.h

068a0023 Andrzej Hajda  2013-12-04   88  		      struct mipi_dsi_device *dsi);
068a0023 Andrzej Hajda  2013-12-04   89  	int (*detach)(struct mipi_dsi_host *host,
068a0023 Andrzej Hajda  2013-12-04   90  		      struct mipi_dsi_device *dsi);
068a0023 Andrzej Hajda  2013-12-04   91  	ssize_t (*transfer)(struct mipi_dsi_host *host,
ed6ff40e Thierry Reding 2014-08-05   92  			    const struct mipi_dsi_msg *msg);
068a0023 Andrzej Hajda  2013-12-04   93  };
068a0023 Andrzej Hajda  2013-12-04   94  
068a0023 Andrzej Hajda  2013-12-04   95  /**
068a0023 Andrzej Hajda  2013-12-04   96   * struct mipi_dsi_host - DSI host device
068a0023 Andrzej Hajda  2013-12-04   97   * @dev: driver model device node for this DSI host
068a0023 Andrzej Hajda  2013-12-04   98   * @ops: DSI host operations
068a0023 Andrzej Hajda  2013-12-04   99   */
068a0023 Andrzej Hajda  2013-12-04  100  struct mipi_dsi_host {
068a0023 Andrzej Hajda  2013-12-04  101  	struct device *dev;
068a0023 Andrzej Hajda  2013-12-04  102  	const struct mipi_dsi_host_ops *ops;
b3e0f8f8 Archit Taneja  2015-10-06  103  	struct list_head list;
068a0023 Andrzej Hajda  2013-12-04 @104  };
068a0023 Andrzej Hajda  2013-12-04  105  
068a0023 Andrzej Hajda  2013-12-04  106  int mipi_dsi_host_register(struct mipi_dsi_host *host);
068a0023 Andrzej Hajda  2013-12-04  107  void mipi_dsi_host_unregister(struct mipi_dsi_host *host);
b3e0f8f8 Archit Taneja  2015-10-06  108  struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node);
068a0023 Andrzej Hajda  2013-12-04  109  
068a0023 Andrzej Hajda  2013-12-04  110  /* DSI mode flags */
068a0023 Andrzej Hajda  2013-12-04  111  
068a0023 Andrzej Hajda  2013-12-04  112  /* video mode */

:::::: The code at line 104 was first introduced by commit
:::::: 068a00233969833f1ba925e7627797489efd6041 drm: Add MIPI DSI bus support

:::::: TO: Andrzej Hajda <a.hajda@samsung.com>
:::::: CC: Thierry Reding <treding@nvidia.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Andrzej Hajda Nov. 2, 2015, 10:50 a.m. UTC | #2
On 10/06/2015 11:24 AM, Archit Taneja wrote:
> mipi_dsi_devices are inherently aware of their host because they
> share a parent-child hierarchy in the device tree.
>
> Non-dsi drivers that create a dummy dsi device don't have this data.
> In order to get this information, they require to a phandle to the dsi
> host in the device tree.
>
> Maintain a list of all the hosts DSI that are currently registered.
>
> This list will be used to find the mipi_dsi_host corresponding to the
> device_node passed in of_find_mipi_dsi_host_by_node.
>
> Signed-off-by: Archit Taneja <architt@codeaurora.org>

Looks OK, beside lack of documentation, after fixing it you can add
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>

Regards
Andrzej

> ---
>  drivers/gpu/drm/drm_mipi_dsi.c | 30 ++++++++++++++++++++++++++++++
>  include/drm/drm_mipi_dsi.h     |  2 ++
>  2 files changed, 32 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
> index cbb7373..c51d73e 100644
> --- a/drivers/gpu/drm/drm_mipi_dsi.c
> +++ b/drivers/gpu/drm/drm_mipi_dsi.c
> @@ -216,6 +216,28 @@ of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node)
>  	return mipi_dsi_device_new(host, &info);
>  }
>  
> +static DEFINE_MUTEX(host_lock);
> +static LIST_HEAD(host_list);
> +
> +struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node)
> +{
> +	struct mipi_dsi_host *host;
> +
> +	mutex_lock(&host_lock);
> +
> +	list_for_each_entry(host, &host_list, list) {
> +		if (host->dev->of_node == node) {
> +			mutex_unlock(&host_lock);
> +			return host;
> +		}
> +	}
> +
> +	mutex_unlock(&host_lock);
> +
> +	return NULL;
> +}
> +EXPORT_SYMBOL(of_find_mipi_dsi_host_by_node);
> +
>  int mipi_dsi_host_register(struct mipi_dsi_host *host)
>  {
>  	struct device_node *node;
> @@ -227,6 +249,10 @@ int mipi_dsi_host_register(struct mipi_dsi_host *host)
>  		of_mipi_dsi_device_add(host, node);
>  	}
>  
> +	mutex_lock(&host_lock);
> +	list_add_tail(&host->list, &host_list);
> +	mutex_unlock(&host_lock);
> +
>  	return 0;
>  }
>  EXPORT_SYMBOL(mipi_dsi_host_register);
> @@ -243,6 +269,10 @@ static int mipi_dsi_remove_device_fn(struct device *dev, void *priv)
>  void mipi_dsi_host_unregister(struct mipi_dsi_host *host)
>  {
>  	device_for_each_child(host->dev, NULL, mipi_dsi_remove_device_fn);
> +
> +	mutex_lock(&host_lock);
> +	list_del_init(&host->list);
> +	mutex_unlock(&host_lock);
>  }
>  EXPORT_SYMBOL(mipi_dsi_host_unregister);
>  
> diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
> index 68f49f4..15d3068 100644
> --- a/include/drm/drm_mipi_dsi.h
> +++ b/include/drm/drm_mipi_dsi.h
> @@ -100,10 +100,12 @@ struct mipi_dsi_host_ops {
>  struct mipi_dsi_host {
>  	struct device *dev;
>  	const struct mipi_dsi_host_ops *ops;
> +	struct list_head list;
>  };
>  
>  int mipi_dsi_host_register(struct mipi_dsi_host *host);
>  void mipi_dsi_host_unregister(struct mipi_dsi_host *host);
> +struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node);
>  
>  /* DSI mode flags */
>  

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Archit Taneja Nov. 3, 2015, 7:20 a.m. UTC | #3
On 11/02/2015 04:20 PM, Andrzej Hajda wrote:
> On 10/06/2015 11:24 AM, Archit Taneja wrote:
>> mipi_dsi_devices are inherently aware of their host because they
>> share a parent-child hierarchy in the device tree.
>>
>> Non-dsi drivers that create a dummy dsi device don't have this data.
>> In order to get this information, they require to a phandle to the dsi
>> host in the device tree.
>>
>> Maintain a list of all the hosts DSI that are currently registered.
>>
>> This list will be used to find the mipi_dsi_host corresponding to the
>> device_node passed in of_find_mipi_dsi_host_by_node.
>>
>> Signed-off-by: Archit Taneja <architt@codeaurora.org>
>
> Looks OK, beside lack of documentation, after fixing it you can add
> Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>

I will add missing documentation before posting v3.

Thanks again for the review.

Archit

>
> Regards
> Andrzej
>
>> ---
>>   drivers/gpu/drm/drm_mipi_dsi.c | 30 ++++++++++++++++++++++++++++++
>>   include/drm/drm_mipi_dsi.h     |  2 ++
>>   2 files changed, 32 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
>> index cbb7373..c51d73e 100644
>> --- a/drivers/gpu/drm/drm_mipi_dsi.c
>> +++ b/drivers/gpu/drm/drm_mipi_dsi.c
>> @@ -216,6 +216,28 @@ of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node)
>>   	return mipi_dsi_device_new(host, &info);
>>   }
>>
>> +static DEFINE_MUTEX(host_lock);
>> +static LIST_HEAD(host_list);
>> +
>> +struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node)
>> +{
>> +	struct mipi_dsi_host *host;
>> +
>> +	mutex_lock(&host_lock);
>> +
>> +	list_for_each_entry(host, &host_list, list) {
>> +		if (host->dev->of_node == node) {
>> +			mutex_unlock(&host_lock);
>> +			return host;
>> +		}
>> +	}
>> +
>> +	mutex_unlock(&host_lock);
>> +
>> +	return NULL;
>> +}
>> +EXPORT_SYMBOL(of_find_mipi_dsi_host_by_node);
>> +
>>   int mipi_dsi_host_register(struct mipi_dsi_host *host)
>>   {
>>   	struct device_node *node;
>> @@ -227,6 +249,10 @@ int mipi_dsi_host_register(struct mipi_dsi_host *host)
>>   		of_mipi_dsi_device_add(host, node);
>>   	}
>>
>> +	mutex_lock(&host_lock);
>> +	list_add_tail(&host->list, &host_list);
>> +	mutex_unlock(&host_lock);
>> +
>>   	return 0;
>>   }
>>   EXPORT_SYMBOL(mipi_dsi_host_register);
>> @@ -243,6 +269,10 @@ static int mipi_dsi_remove_device_fn(struct device *dev, void *priv)
>>   void mipi_dsi_host_unregister(struct mipi_dsi_host *host)
>>   {
>>   	device_for_each_child(host->dev, NULL, mipi_dsi_remove_device_fn);
>> +
>> +	mutex_lock(&host_lock);
>> +	list_del_init(&host->list);
>> +	mutex_unlock(&host_lock);
>>   }
>>   EXPORT_SYMBOL(mipi_dsi_host_unregister);
>>
>> diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
>> index 68f49f4..15d3068 100644
>> --- a/include/drm/drm_mipi_dsi.h
>> +++ b/include/drm/drm_mipi_dsi.h
>> @@ -100,10 +100,12 @@ struct mipi_dsi_host_ops {
>>   struct mipi_dsi_host {
>>   	struct device *dev;
>>   	const struct mipi_dsi_host_ops *ops;
>> +	struct list_head list;
>>   };
>>
>>   int mipi_dsi_host_register(struct mipi_dsi_host *host);
>>   void mipi_dsi_host_unregister(struct mipi_dsi_host *host);
>> +struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node);
>>
>>   /* DSI mode flags */
>>
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index cbb7373..c51d73e 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -216,6 +216,28 @@  of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node)
 	return mipi_dsi_device_new(host, &info);
 }
 
+static DEFINE_MUTEX(host_lock);
+static LIST_HEAD(host_list);
+
+struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node)
+{
+	struct mipi_dsi_host *host;
+
+	mutex_lock(&host_lock);
+
+	list_for_each_entry(host, &host_list, list) {
+		if (host->dev->of_node == node) {
+			mutex_unlock(&host_lock);
+			return host;
+		}
+	}
+
+	mutex_unlock(&host_lock);
+
+	return NULL;
+}
+EXPORT_SYMBOL(of_find_mipi_dsi_host_by_node);
+
 int mipi_dsi_host_register(struct mipi_dsi_host *host)
 {
 	struct device_node *node;
@@ -227,6 +249,10 @@  int mipi_dsi_host_register(struct mipi_dsi_host *host)
 		of_mipi_dsi_device_add(host, node);
 	}
 
+	mutex_lock(&host_lock);
+	list_add_tail(&host->list, &host_list);
+	mutex_unlock(&host_lock);
+
 	return 0;
 }
 EXPORT_SYMBOL(mipi_dsi_host_register);
@@ -243,6 +269,10 @@  static int mipi_dsi_remove_device_fn(struct device *dev, void *priv)
 void mipi_dsi_host_unregister(struct mipi_dsi_host *host)
 {
 	device_for_each_child(host->dev, NULL, mipi_dsi_remove_device_fn);
+
+	mutex_lock(&host_lock);
+	list_del_init(&host->list);
+	mutex_unlock(&host_lock);
 }
 EXPORT_SYMBOL(mipi_dsi_host_unregister);
 
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 68f49f4..15d3068 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -100,10 +100,12 @@  struct mipi_dsi_host_ops {
 struct mipi_dsi_host {
 	struct device *dev;
 	const struct mipi_dsi_host_ops *ops;
+	struct list_head list;
 };
 
 int mipi_dsi_host_register(struct mipi_dsi_host *host);
 void mipi_dsi_host_unregister(struct mipi_dsi_host *host);
+struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node);
 
 /* DSI mode flags */