From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933328AbbGGVA3 (ORCPT ); Tue, 7 Jul 2015 17:00:29 -0400 Received: from cantor2.suse.de ([195.135.220.15]:35901 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933099AbbGGVAX (ORCPT ); Tue, 7 Jul 2015 17:00:23 -0400 Date: Tue, 7 Jul 2015 23:00:19 +0200 From: Jean Delvare To: Benjamin Tissoires Cc: Wolfram Sang , Dmitry Torokhov , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] i2c: i801: add support of Host Notify Message-ID: <20150707230019.5d70c26a@endymion.delvare> In-Reply-To: <20150707201638.GK18484@mail.corp.redhat.com> References: <1435085899-11017-1-git-send-email-benjamin.tissoires@redhat.com> <1435085899-11017-3-git-send-email-benjamin.tissoires@redhat.com> <20150707201125.66b2b5b9@endymion.delvare> <20150707201638.GK18484@mail.corp.redhat.com> Organization: SUSE Linux X-Mailer: Claws Mail 3.10.1 (GTK+ 2.24.23; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 7 Jul 2015 16:16:38 -0400, Benjamin Tissoires wrote: > On Jul 07 2015 or thereabouts, Jean Delvare wrote: > > So you use the same driver callback for SMBus Alert and SMBus Host > > Notify. This makes some sense, but if a given driver supports both, how > > does it know which event happened? The data is completely different and > > most probably the action required from the driver as well. > > Yeah, this gets messy. I re-used the .alert() callback because of the > documentation: "Alert callback, for example for the SMBus alert protocol". > It would seem that the alert is generic and could be re-used. But OTOH, > it is not prepared to receive anything else than a SMBus Alert. > > Given that I had a toggle_host_notify() call, I figured that this was > not a problem unless you write a driver which implements both (I can not > find a sane use case for this though). > > But now that this call has disappeared, we would need a way to > differentiate the too of them. > > I can see two solutions out of my head right now: > - add a "protocol" parameter (with an enum) to .alert() > - add a new callback .host_notify() in struct i2c_driver. I came to the same conclusion. > I think I like the second option more given that it will allow to not > touch the current code in i2c_smbus. No strong preference so do it the way you prefer. Thanks, -- Jean Delvare SUSE L3 Support