Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	"Matthew Brost" <matthew.brost@intel.com>,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	"Raag Jadav" <raag.jadav@intel.com>,
	"Michael J . Ruhl" <michael.j.ruhl@intel.com>,
	"Mika Westerberg" <mika.westerberg@linux.intel.com>,
	"Riana Tauro" <riana.tauro@intel.com>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 1/2] drm/xe/i2c: Handler for SMBus Alerts
Date: Tue, 23 Jun 2026 14:44:23 +0300	[thread overview]
Message-ID: <ajpxl3QTu7GfOmKN@kuha> (raw)
In-Reply-To: <ajpl3Tv-bCc8kfWG@ashevche-desk.local>

On Tue, Jun 23, 2026 at 01:54:21PM +0300, Andy Shevchenko wrote:
> On Mon, Jun 22, 2026 at 01:47:58PM +0200, Heikki Krogerus wrote:
> > Some devices that are attached to the I2C controller use the
> > SMBus Alert signal for example to inform the host about
> > thermal events, so registering the default SMBus Alert
> > device device for them. The alert device makes sure that
> > the alert is processed and passed to the correct I2C client
> > driver.
> 
> ...
> 
> > +	if (i2c->smbus_alert)
> 
> Unneeded. Also the below incorporates error pointer cases.
> 
> > +		i2c_unregister_device(i2c->smbus_alert);
> > +
> >  	if (!i2c->irqdomain)
> >  		return;
> 
> ...
> 
> > +++ b/drivers/gpu/drm/xe/xe_i2c_smbus.c
> > @@ -0,0 +1,59 @@
> > +// SPDX-License-Identifier: GPL-2.0-or-later
> > +/*
> > + * Intel Xe SMBus handling
> > + *
> > + * Copyright (C) 2026 Intel Corporation.
> > + */
> 
> + bits.h // BIT()
> + err.h // IS_ERR()
> 
> > +#include <linux/i2c-smbus.h>
> > +#include <linux/regmap.h>
> > +#include <linux/types.h>
> 
> ...
> 
> > +static struct i2c_smbus_alert_setup xe_i2c_smbus_setup;
> > +
> > +int xe_i2c_register_smbus_alert(struct xe_i2c *i2c)
> > +{
> > +	struct i2c_client *alert;
> > +
> > +	alert = i2c_new_smbus_alert_device(i2c->adapter, &xe_i2c_smbus_setup);
> > +	if (IS_ERR(alert))
> > +		return PTR_ERR(alert);
> > +
> > +	i2c->smbus_alert = alert;
> > +
> > +	return 0;
> > +}
> 
> As per above comment, this IS_ERR() is not need, as the removal API is optional-aware.
> OTOH, the other NULL-check in the driver in that case needs to be IS_ERR_OR_NULL().
> 
> But I'm not sure if you want to have alert setup to always succeed.

Thanks Andy. I'll get these fixed.

I have to refactor the code a little. It does not seem to be possible
to try to conditionally include this file based on CONFIG_I2C_SMBUS
like I'm doing now, so I'm going to propose that CONFIG_XE selects
CONFIG_I2C_SMBUS in v2. Since there are only two functions here, I'll
just move them to xe_i2c.c

cheers,

-- 
heikki

  reply	other threads:[~2026-06-23 11:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-22 11:47 [PATCH v1 0/2] drm/xe/i2c: alerts and controller enabling modifications Heikki Krogerus
2026-06-22 11:47 ` [PATCH v1 1/2] drm/xe/i2c: Handler for SMBus Alerts Heikki Krogerus
2026-06-23 10:54   ` Andy Shevchenko
2026-06-23 11:44     ` Heikki Krogerus [this message]
2026-06-23 14:34   ` Raag Jadav
2026-06-22 11:47 ` [PATCH v1 2/2] drm/xe/mcu_i2c: Take over control of the controller enabling Heikki Krogerus
2026-06-23 10:56   ` Andy Shevchenko
2026-06-23 14:58     ` Raag Jadav
2026-06-23 18:10       ` Andy Shevchenko
2026-06-23 14:39   ` Raag Jadav
2026-06-22 16:34 ` ✗ CI.checkpatch: warning for drm/xe/i2c: alerts and controller enabling modifications Patchwork
2026-06-22 16:35 ` ✓ CI.KUnit: success " Patchwork
2026-06-22 17:36 ` ✓ Xe.CI.BAT: " Patchwork
2026-06-22 20:38 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-06-23 10:15 ` [PATCH v1 0/2] " Heikki Krogerus
2026-06-23 14:40   ` Raag Jadav

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=ajpxl3QTu7GfOmKN@kuha \
    --to=heikki.krogerus@linux.intel.com \
    --cc=airlied@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.brost@intel.com \
    --cc=michael.j.ruhl@intel.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=raag.jadav@intel.com \
    --cc=riana.tauro@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=simona@ffwll.ch \
    --cc=thomas.hellstrom@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox