From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: Re: [Intel-gfx] [PATCH v1] drm/i915/dsi: Drop double check for ACPI companion device
Date: Wed, 22 Jul 2020 14:33:28 +0300 [thread overview]
Message-ID: <20200722113328.GA6112@intel.com> (raw)
In-Reply-To: <20200529123317.20470-1-andriy.shevchenko@linux.intel.com>
On Fri, May 29, 2020 at 03:33:17PM +0300, Andy Shevchenko wrote:
> acpi_dev_get_resources() does perform the NULL pointer check against
> ACPI companion device which is given as function parameter. Thus,
> there is no need to duplicate this check in the caller.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Sorry, I did look at this but apparently forgot to reply...
> ---
> drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 24 ++++++++------------
> 1 file changed, 10 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_dsi_vbt.c b/drivers/gpu/drm/i915/display/intel_dsi_vbt.c
> index 574dcfec9577..6f9e08cda964 100644
> --- a/drivers/gpu/drm/i915/display/intel_dsi_vbt.c
> +++ b/drivers/gpu/drm/i915/display/intel_dsi_vbt.c
> @@ -426,23 +426,19 @@ static void i2c_acpi_find_adapter(struct intel_dsi *intel_dsi,
> {
> struct drm_device *drm_dev = intel_dsi->base.base.dev;
> struct device *dev = &drm_dev->pdev->dev;
> - struct acpi_device *acpi_dev;
> + struct acpi_device *acpi_dev = ACPI_COMPANION(dev);
> struct list_head resource_list;
> struct i2c_adapter_lookup lookup;
>
> - acpi_dev = ACPI_COMPANION(dev);
> - if (acpi_dev) {
> - memset(&lookup, 0, sizeof(lookup));
> - lookup.slave_addr = slave_addr;
> - lookup.intel_dsi = intel_dsi;
> - lookup.dev_handle = acpi_device_handle(acpi_dev);
> -
> - INIT_LIST_HEAD(&resource_list);
> - acpi_dev_get_resources(acpi_dev, &resource_list,
> - i2c_adapter_lookup,
> - &lookup);
> - acpi_dev_free_resource_list(&resource_list);
> - }
> + memset(&lookup, 0, sizeof(lookup));
> + lookup.slave_addr = slave_addr;
> + lookup.intel_dsi = intel_dsi;
> + lookup.dev_handle = acpi_device_handle(acpi_dev);
struct i2c_adapter_lookup lookup = {
.slave_addr = ...
};
?
> +
> + INIT_LIST_HEAD(&resource_list);
Declare as LIST_HEAD(resource_list); ?
> + acpi_dev_get_resources(acpi_dev, &resource_list,
> + i2c_adapter_lookup, &lookup);
> + acpi_dev_free_resource_list(&resource_list);
I was very confused by this code since on the first glance it appears to
absolutely nothing. After a deeper look it looks like
i2c_adapter_lookup() magically mutates intel_dsi->i2c_bus_num.
Did I mention I hate functions with side effects? IMO would be much
better if i2c_adapter_lookup() did what it says on the tin and just
returned the adapter number and let the caller deal with it. But
this is a pre-existing issue with the code and so not directly related
to your patch.
> }
> #else
> static inline void i2c_acpi_find_adapter(struct intel_dsi *intel_dsi,
> --
> 2.26.2
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v1] drm/i915/dsi: Drop double check for ACPI companion device
Date: Wed, 22 Jul 2020 14:33:28 +0300 [thread overview]
Message-ID: <20200722113328.GA6112@intel.com> (raw)
In-Reply-To: <20200529123317.20470-1-andriy.shevchenko@linux.intel.com>
On Fri, May 29, 2020 at 03:33:17PM +0300, Andy Shevchenko wrote:
> acpi_dev_get_resources() does perform the NULL pointer check against
> ACPI companion device which is given as function parameter. Thus,
> there is no need to duplicate this check in the caller.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Sorry, I did look at this but apparently forgot to reply...
> ---
> drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 24 ++++++++------------
> 1 file changed, 10 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_dsi_vbt.c b/drivers/gpu/drm/i915/display/intel_dsi_vbt.c
> index 574dcfec9577..6f9e08cda964 100644
> --- a/drivers/gpu/drm/i915/display/intel_dsi_vbt.c
> +++ b/drivers/gpu/drm/i915/display/intel_dsi_vbt.c
> @@ -426,23 +426,19 @@ static void i2c_acpi_find_adapter(struct intel_dsi *intel_dsi,
> {
> struct drm_device *drm_dev = intel_dsi->base.base.dev;
> struct device *dev = &drm_dev->pdev->dev;
> - struct acpi_device *acpi_dev;
> + struct acpi_device *acpi_dev = ACPI_COMPANION(dev);
> struct list_head resource_list;
> struct i2c_adapter_lookup lookup;
>
> - acpi_dev = ACPI_COMPANION(dev);
> - if (acpi_dev) {
> - memset(&lookup, 0, sizeof(lookup));
> - lookup.slave_addr = slave_addr;
> - lookup.intel_dsi = intel_dsi;
> - lookup.dev_handle = acpi_device_handle(acpi_dev);
> -
> - INIT_LIST_HEAD(&resource_list);
> - acpi_dev_get_resources(acpi_dev, &resource_list,
> - i2c_adapter_lookup,
> - &lookup);
> - acpi_dev_free_resource_list(&resource_list);
> - }
> + memset(&lookup, 0, sizeof(lookup));
> + lookup.slave_addr = slave_addr;
> + lookup.intel_dsi = intel_dsi;
> + lookup.dev_handle = acpi_device_handle(acpi_dev);
struct i2c_adapter_lookup lookup = {
.slave_addr = ...
};
?
> +
> + INIT_LIST_HEAD(&resource_list);
Declare as LIST_HEAD(resource_list); ?
> + acpi_dev_get_resources(acpi_dev, &resource_list,
> + i2c_adapter_lookup, &lookup);
> + acpi_dev_free_resource_list(&resource_list);
I was very confused by this code since on the first glance it appears to
absolutely nothing. After a deeper look it looks like
i2c_adapter_lookup() magically mutates intel_dsi->i2c_bus_num.
Did I mention I hate functions with side effects? IMO would be much
better if i2c_adapter_lookup() did what it says on the tin and just
returned the adapter number and let the caller deal with it. But
this is a pre-existing issue with the code and so not directly related
to your patch.
> }
> #else
> static inline void i2c_acpi_find_adapter(struct intel_dsi *intel_dsi,
> --
> 2.26.2
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2020-07-22 11:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-29 12:33 [PATCH v1] drm/i915/dsi: Drop double check for ACPI companion device Andy Shevchenko
2020-05-29 12:33 ` [Intel-gfx] " Andy Shevchenko
2020-05-29 13:45 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2020-05-29 15:28 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2020-07-21 16:00 ` [PATCH v1] " Andy Shevchenko
2020-07-21 16:00 ` [Intel-gfx] " Andy Shevchenko
2020-07-22 11:33 ` Ville Syrjälä [this message]
2020-07-22 11:33 ` Ville Syrjälä
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200722113328.GA6112@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=rodrigo.vivi@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.