Commit 1e8d19d9 authored by Tomas Winkler's avatar Tomas Winkler Committed by Greg Kroah-Hartman

mei: hdcp: bind only with i915 on the same PCH

The mei device and i915 must reside on the same
PCH in order for HDCP to work. Make the component
matching function enforce this requirement.

                   hdcp
                    |
   i915            mei
    |               |
    +----= PCH =----+

Cc: <stable@vger.kernel.org> v5.0+
Cc: Ramalingam C <ramalingam.c@intel.com>
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Reviewed-by: default avatarAlexander Usyskin <alexander.usyskin@intel.com>
Link: https://lore.kernel.org/r/20191212084103.2893-1-tomas.winkler@intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 49ef431d
...@@ -757,11 +757,38 @@ static const struct component_master_ops mei_component_master_ops = { ...@@ -757,11 +757,38 @@ static const struct component_master_ops mei_component_master_ops = {
.unbind = mei_component_master_unbind, .unbind = mei_component_master_unbind,
}; };
/**
* mei_hdcp_component_match - compare function for matching mei hdcp.
*
* The function checks if the driver is i915, the subcomponent is HDCP
* and the grand parent of hdcp and the parent of i915 are the same
* PCH device.
*
* @dev: master device
* @subcomponent: subcomponent to match (I915_COMPONENT_HDCP)
* @data: compare data (mei hdcp device)
*
* Return:
* * 1 - if components match
* * 0 - otherwise
*/
static int mei_hdcp_component_match(struct device *dev, int subcomponent, static int mei_hdcp_component_match(struct device *dev, int subcomponent,
void *data) void *data)
{ {
return !strcmp(dev->driver->name, "i915") && struct device *base = data;
subcomponent == I915_COMPONENT_HDCP;
if (strcmp(dev->driver->name, "i915") ||
subcomponent != I915_COMPONENT_HDCP)
return 0;
base = base->parent;
if (!base)
return 0;
base = base->parent;
dev = dev->parent;
return (base && dev && dev == base);
} }
static int mei_hdcp_probe(struct mei_cl_device *cldev, static int mei_hdcp_probe(struct mei_cl_device *cldev,
...@@ -785,7 +812,7 @@ static int mei_hdcp_probe(struct mei_cl_device *cldev, ...@@ -785,7 +812,7 @@ static int mei_hdcp_probe(struct mei_cl_device *cldev,
master_match = NULL; master_match = NULL;
component_match_add_typed(&cldev->dev, &master_match, component_match_add_typed(&cldev->dev, &master_match,
mei_hdcp_component_match, comp_master); mei_hdcp_component_match, &cldev->dev);
if (IS_ERR_OR_NULL(master_match)) { if (IS_ERR_OR_NULL(master_match)) {
ret = -ENOMEM; ret = -ENOMEM;
goto err_exit; goto err_exit;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment