From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E4443D412C for ; Tue, 23 Jun 2026 11:44:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782215071; cv=none; b=TVOgwgcqFROaw5Bk0tGEcFKH8KZ3HGhzRibpsdD4vg1Hep7RERemsmxvaw9Dk/VBro6Y7fotTAtefWPiX0RhJ8tmkNqkapUmkiHX77fXPmFxd5jKiiBubDt9qWCe9qNUkpDSghbKbrEbaVrxG6M/BiYBR6ZoR0rH+mxEhXNseTk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782215071; c=relaxed/simple; bh=KfC7LNEf+rWrSynyjXVPHNi3QlrfnqyM/nZvUmXLib0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Hm8nak9XK+oOpsC5jO3Vtrz6sxJsREh/Yrm/CRH89hgvZYQ1rV9lf1kmbbFmS2QhB9M3GvtflbjS5EPQCBKQHdpCkaGoFl7nsWgHUs6ZpNI+NnNwaMWUzw3kKjhXNQ7DmKMfpckWhWcCEviRgS3SFPIVWVlz4jUzo5NcmFJS+eM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=YWQL+7dE; arc=none smtp.client-ip=192.198.163.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="YWQL+7dE" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1782215070; x=1813751070; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=KfC7LNEf+rWrSynyjXVPHNi3QlrfnqyM/nZvUmXLib0=; b=YWQL+7dEex2yrB86i1w3JIaLjiEnO0ht9jYbBerieGgwI9+f79/QNxcF AbiAnUOYMmKe84XqLu3o2u3jUmuiRPgAyG537TeXKEH/HmRZE5Z7bsUf7 3Z++CVVLl+NeeD7tvWmcapMZF3yniiTi1CfS3IhYjbIe8BFgRAo4AVVPw B26CJg+0QpsUAVtoejiEq3szGlmYCJYwHA+PjMrIUzN2zmqtO9UafXp2n zmjq2udQ2z5CUjtLqxV3FEDxMCy6DvKyz92zw3zFcRxriHRyB54inwWyX 1UZc6jRvUedYhl3bzctHNUkTTK7InCeHUmztMfckCpl0av375Xz38yFmY A==; X-CSE-ConnectionGUID: Fkzu1CDRSBa9bk5eCPiRZQ== X-CSE-MsgGUID: zVu4VwwRQxaRXB03tr57Eg== X-IronPort-AV: E=McAfee;i="6800,10657,11825"; a="82997039" X-IronPort-AV: E=Sophos;i="6.24,220,1774335600"; d="scan'208";a="82997039" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2026 04:44:29 -0700 X-CSE-ConnectionGUID: vkZSM7zBQQ+LKAC5sKVMOg== X-CSE-MsgGUID: MejXlA9ER2WqsOvVnLYVRg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.24,220,1774335600"; d="scan'208";a="249615576" Received: from black.igk.intel.com ([10.91.253.5]) by orviesa009.jf.intel.com with ESMTP; 23 Jun 2026 04:44:25 -0700 Received: by black.igk.intel.com (Postfix, from userid 1008) id AF54D95; Tue, 23 Jun 2026 13:44:24 +0200 (CEST) Date: Tue, 23 Jun 2026 14:44:23 +0300 From: Heikki Krogerus To: Andy Shevchenko Cc: Rodrigo Vivi , Matthew Brost , Thomas =?iso-8859-1?Q?Hellstr=F6m?= , Raag Jadav , "Michael J . Ruhl" , Mika Westerberg , Riana Tauro , David Airlie , Simona Vetter , 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 Message-ID: References: <20260622114759.3464047-1-heikki.krogerus@linux.intel.com> <20260622114759.3464047-2-heikki.krogerus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 > > +#include > > +#include > > ... > > > +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