From: Charles Keepax <ckeepax@opensource.cirrus.com> To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Cc: mark.rutland@arm.com, alsa-devel@alsa-project.org, michael.opdenacker@free-electrons.com, poeschel@lemonage.de, andreas.noever@gmail.com, gong.chen@linux.intel.com, arnd@arndb.de, kheitke@audience.com, treding@nvidia.com, devicetree@vger.kernel.org, james.hogan@imgtec.com, pawel.moll@arm.com, linux-arm-msm@vger.kernel.org, sharon.dvir1@mail.huji.ac.il, robh+dt@kernel.org, sdharia@codeaurora.org, alan@linux.intel.com, bp@suse.de, mathieu.poirier@linaro.org, jkosina@suse.cz, linux-kernel@vger.kernel.org, broonie@kernel.org, daniel@ffwll.ch, gregkh@linuxfoundation.org, joe@perches.com, davem@davemloft.net Subject: Re: [Patch v6 1/7] slimbus: Device management on SLIMbus Date: Tue, 10 Oct 2017 13:56:18 +0100 [thread overview] Message-ID: <20171010125618.tb2hq5ec24xjfzpx@localhost.localdomain> (raw) In-Reply-To: <6dc24d42-7c40-9ffe-6be5-bf38d712222b@linaro.org> On Tue, Oct 10, 2017 at 01:34:48PM +0100, Srinivas Kandagatla wrote: > Thanks for the review comments. > > On 10/10/17 11:05, Charles Keepax wrote: > > On Fri, Oct 06, 2017 at 05:51:30PM +0200, srinivas.kandagatla@linaro.org wrote: > > > +Required property for SLIMbus child node if it is present: > > > +- reg - Is Duplex (Device index, Instance ID) from Enumeration > > > + Address. > > > + Device Index Uniquely identifies multiple Devices within > > > + a single Component. > > > + Instance ID Is for the cases where multiple Devices of the > > > + same type or Class are attached to the bus. > > > + > > > +- compatible -"slimMID,PID". The textual representation of Manufacturer ID, > > > + Product Code, shall be in lower case hexadecimal with leading > > > + zeroes suppressed > > > > This does sort of make sense but kinda makes the code a bit ugly > > parsing the MID and PID. Some parts will support SLIMBus and also > > other control interfaces, which means they would need to add an > > additional compatible string just for SLIMBus. It also breaks > > the normal conventions of vendor,part and finally it makes the > > compatible strings really unreadable which will be a bit annoying > > when looking at DTs. > > > This change was made inline to the comments provided in previous version of > the patch https://lkml.org/lkml/2016/5/3/576 > > > I think the MID and PID should just be included in the reg field > > and just leave this as a standard compatible. > > AFAIK, reg field should only contain index and instance, which was also > discussed at https://lkml.org/lkml/2016/5/3/747 > Thanks for the links, if people are determined this is the way to go I can live with it. I guess my primary objection is the fact my parts are going to have different compatibles depending on if they are on I2C/SPI or on SLIMBus (we have many parts that support all three on the same chip) which feels like it violates the principle of least surprise. Will wait to see if Arnd or Rob have anymore thoughts to offer. > > > +/* Helper to get hex Manufacturer ID and Product id from compatible */ > > > +static unsigned long str2hex(unsigned char *str) > > > +{ > > > + int value = 0; > > > + > > > + while (*str) { > > > + char c = *str++; > > > + > > > + value = value << 4; > > > + if (c >= '0' && c <= '9') > > > + value |= (c - '0'); > > > + if (c >= 'a' && c <= 'f') > > > + value |= (c - 'a' + 10); > > > + > > > + } > > > + > > > + return value; > > > +} > > > > Isn't this just reimplementing kstrtoul? > > > I would say partly, I think kstrtoul will only parse string as hex if its > prefixed with "0x" But the compatible does not have 0x prefix.. > we could probably do some prefixing before passing to kstrtoul to remove > above function.. I will try that and see! > I am pretty sure kstrtoul is happy without the 0x as long as you specify the base as 16 which I guess you should be doing here. Thanks, Charles
WARNING: multiple messages have this Message-ID (diff)
From: Charles Keepax <ckeepax@opensource.cirrus.com> To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Cc: <gregkh@linuxfoundation.org>, <broonie@kernel.org>, <alsa-devel@alsa-project.org>, <mark.rutland@arm.com>, <michael.opdenacker@free-electrons.com>, <poeschel@lemonage.de>, <andreas.noever@gmail.com>, <gong.chen@linux.intel.com>, <arnd@arndb.de>, <kheitke@audience.com>, <bp@suse.de>, <devicetree@vger.kernel.org>, <james.hogan@imgtec.com>, <pawel.moll@arm.com>, <linux-arm-msm@vger.kernel.org>, <sharon.dvir1@mail.huji.ac.il>, <robh+dt@kernel.org>, <sdharia@codeaurora.org>, <alan@linux.intel.com>, <treding@nvidia.com>, <mathieu.poirier@linaro.org>, <jkosina@suse.cz>, <linux-kernel@vger.kernel.org>, <daniel@ffwll.ch>, <joe@perches.com>, <davem@davemloft.net> Subject: Re: [alsa-devel] [Patch v6 1/7] slimbus: Device management on SLIMbus Date: Tue, 10 Oct 2017 13:56:18 +0100 [thread overview] Message-ID: <20171010125618.tb2hq5ec24xjfzpx@localhost.localdomain> (raw) In-Reply-To: <6dc24d42-7c40-9ffe-6be5-bf38d712222b@linaro.org> On Tue, Oct 10, 2017 at 01:34:48PM +0100, Srinivas Kandagatla wrote: > Thanks for the review comments. > > On 10/10/17 11:05, Charles Keepax wrote: > > On Fri, Oct 06, 2017 at 05:51:30PM +0200, srinivas.kandagatla@linaro.org wrote: > > > +Required property for SLIMbus child node if it is present: > > > +- reg - Is Duplex (Device index, Instance ID) from Enumeration > > > + Address. > > > + Device Index Uniquely identifies multiple Devices within > > > + a single Component. > > > + Instance ID Is for the cases where multiple Devices of the > > > + same type or Class are attached to the bus. > > > + > > > +- compatible -"slimMID,PID". The textual representation of Manufacturer ID, > > > + Product Code, shall be in lower case hexadecimal with leading > > > + zeroes suppressed > > > > This does sort of make sense but kinda makes the code a bit ugly > > parsing the MID and PID. Some parts will support SLIMBus and also > > other control interfaces, which means they would need to add an > > additional compatible string just for SLIMBus. It also breaks > > the normal conventions of vendor,part and finally it makes the > > compatible strings really unreadable which will be a bit annoying > > when looking at DTs. > > > This change was made inline to the comments provided in previous version of > the patch https://lkml.org/lkml/2016/5/3/576 > > > I think the MID and PID should just be included in the reg field > > and just leave this as a standard compatible. > > AFAIK, reg field should only contain index and instance, which was also > discussed at https://lkml.org/lkml/2016/5/3/747 > Thanks for the links, if people are determined this is the way to go I can live with it. I guess my primary objection is the fact my parts are going to have different compatibles depending on if they are on I2C/SPI or on SLIMBus (we have many parts that support all three on the same chip) which feels like it violates the principle of least surprise. Will wait to see if Arnd or Rob have anymore thoughts to offer. > > > +/* Helper to get hex Manufacturer ID and Product id from compatible */ > > > +static unsigned long str2hex(unsigned char *str) > > > +{ > > > + int value = 0; > > > + > > > + while (*str) { > > > + char c = *str++; > > > + > > > + value = value << 4; > > > + if (c >= '0' && c <= '9') > > > + value |= (c - '0'); > > > + if (c >= 'a' && c <= 'f') > > > + value |= (c - 'a' + 10); > > > + > > > + } > > > + > > > + return value; > > > +} > > > > Isn't this just reimplementing kstrtoul? > > > I would say partly, I think kstrtoul will only parse string as hex if its > prefixed with "0x" But the compatible does not have 0x prefix.. > we could probably do some prefixing before passing to kstrtoul to remove > above function.. I will try that and see! > I am pretty sure kstrtoul is happy without the 0x as long as you specify the base as 16 which I guess you should be doing here. Thanks, Charles
next prev parent reply other threads:[~2017-10-10 12:56 UTC|newest] Thread overview: 89+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-10-06 15:51 [Patch v6 0/7] Introduce framework for SLIMbus device drivers srinivas.kandagatla 2017-10-06 15:51 ` [Patch v6 1/7] slimbus: Device management on SLIMbus srinivas.kandagatla 2017-10-06 15:51 ` srinivas.kandagatla 2017-10-10 10:05 ` Charles Keepax 2017-10-10 10:05 ` [alsa-devel] " Charles Keepax 2017-10-10 12:34 ` Srinivas Kandagatla 2017-10-10 12:34 ` [alsa-devel] " Srinivas Kandagatla 2017-10-10 12:56 ` Charles Keepax [this message] 2017-10-10 12:56 ` Charles Keepax 2017-10-11 10:23 ` Mark Brown 2017-10-11 10:23 ` [alsa-devel] " Mark Brown [not found] ` <20171006155136.4682-2-srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> 2017-10-07 4:14 ` Jonathan Neuschäfer 2017-10-07 4:14 ` Jonathan Neuschäfer 2017-10-07 10:24 ` Srinivas Kandagatla 2017-10-07 10:24 ` Srinivas Kandagatla 2017-10-10 10:45 ` [alsa-devel] " Vinod Koul 2017-10-10 10:45 ` Vinod Koul 2017-10-10 12:34 ` Srinivas Kandagatla 2017-10-10 16:49 ` Vinod Koul 2017-10-10 16:49 ` [alsa-devel] " Vinod Koul 2017-10-10 17:21 ` Srinivas Kandagatla 2017-10-11 4:07 ` Vinod Koul 2017-10-11 9:42 ` Srinivas Kandagatla 2017-10-11 10:21 ` Vinod Koul 2017-10-11 11:23 ` Srinivas Kandagatla 2017-10-13 19:26 ` Rob Herring 2017-10-13 19:26 ` Rob Herring 2017-10-16 9:28 ` Srinivas Kandagatla 2017-10-16 9:28 ` Srinivas Kandagatla 2017-10-17 6:23 ` Bjorn Andersson 2017-10-17 6:23 ` Bjorn Andersson 2017-10-18 16:38 ` Srinivas Kandagatla 2017-10-18 16:38 ` Srinivas Kandagatla [not found] ` <1a1d2777-be69-98ca-afba-0ffd0e3dd80f-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> 2017-11-01 23:08 ` Bjorn Andersson 2017-11-01 23:08 ` Bjorn Andersson 2017-10-25 0:16 ` Stephen Boyd 2017-10-25 0:16 ` Stephen Boyd 2017-10-12 11:01 ` [alsa-devel] " Sanyog Kale 2017-10-12 13:26 ` Srinivas Kandagatla 2017-10-12 13:26 ` Srinivas Kandagatla 2017-10-23 9:06 ` Mark Brown 2017-10-06 15:51 ` [Patch v6 3/7] slimbus: qcom: Add Qualcomm Slimbus controller driver srinivas.kandagatla 2017-10-07 7:45 ` Jonathan Neuschäfer 2017-10-07 10:24 ` Srinivas Kandagatla 2017-10-07 10:24 ` Srinivas Kandagatla 2017-10-13 19:17 ` Rob Herring 2017-10-16 9:28 ` Srinivas Kandagatla 2017-10-18 7:27 ` Bjorn Andersson 2017-10-18 16:39 ` Srinivas Kandagatla 2017-10-06 15:51 ` [Patch v6 4/7] slimbus: Add support for 'clock-pause' feature srinivas.kandagatla 2017-10-07 8:06 ` Jonathan Neuschäfer 2017-10-07 10:24 ` Srinivas Kandagatla [not found] ` <20171006155136.4682-1-srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> 2017-10-06 15:51 ` [Patch v6 2/7] slimbus: Add messaging APIs to slimbus framework srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A 2017-10-06 15:51 ` srinivas.kandagatla 2017-10-07 6:42 ` Jonathan Neuschäfer 2017-10-07 10:24 ` Srinivas Kandagatla 2017-10-07 10:24 ` Srinivas Kandagatla 2017-10-07 12:29 ` Jonathan Neuschäfer 2017-10-10 12:19 ` Charles Keepax 2017-10-10 12:19 ` [alsa-devel] " Charles Keepax 2017-10-10 13:01 ` Srinivas Kandagatla 2017-10-10 13:01 ` [alsa-devel] " Srinivas Kandagatla 2017-10-11 4:38 ` Vinod Koul 2017-10-11 7:53 ` Arnd Bergmann 2017-10-11 7:53 ` Arnd Bergmann 2017-10-11 9:42 ` Srinivas Kandagatla 2017-10-11 9:42 ` [alsa-devel] " Srinivas Kandagatla [not found] ` <aa117cb8-ba59-894c-5a82-1b38facfa841-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> 2017-10-11 10:24 ` Vinod Koul 2017-10-11 10:24 ` Vinod Koul 2017-10-11 11:12 ` Srinivas Kandagatla 2017-10-18 6:15 ` Bjorn Andersson 2017-10-18 16:39 ` Srinivas Kandagatla 2017-10-20 5:00 ` Bjorn Andersson 2017-10-20 5:00 ` Bjorn Andersson 2017-10-06 15:51 ` [Patch v6 5/7] slimbus: qcom: Add runtime-pm support using clock-pause feature srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A 2017-10-06 15:51 ` srinivas.kandagatla 2017-10-07 8:22 ` Jonathan Neuschäfer 2017-10-07 10:25 ` Srinivas Kandagatla 2017-10-06 15:51 ` [Patch v6 7/7] MAINTAINERS: Add SLIMbus maintainer srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A 2017-10-06 15:51 ` srinivas.kandagatla 2017-10-20 5:00 ` Bjorn Andersson 2017-10-20 5:00 ` Bjorn Andersson 2017-10-06 15:51 ` [Patch v6 6/7] regmap: add SLIMBUS support srinivas.kandagatla 2017-10-07 5:02 ` Jonathan Neuschäfer 2017-10-07 10:25 ` Srinivas Kandagatla 2017-10-20 5:00 ` Bjorn Andersson 2017-10-20 5:00 ` Bjorn Andersson 2017-10-25 0:43 [Patch v6 1/7] slimbus: Device management on SLIMbus Rishi Bhattacharya 2017-10-25 0:43 ` Rishi Bhattacharya
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=20171010125618.tb2hq5ec24xjfzpx@localhost.localdomain \ --to=ckeepax@opensource.cirrus.com \ --cc=alan@linux.intel.com \ --cc=alsa-devel@alsa-project.org \ --cc=andreas.noever@gmail.com \ --cc=arnd@arndb.de \ --cc=bp@suse.de \ --cc=broonie@kernel.org \ --cc=daniel@ffwll.ch \ --cc=davem@davemloft.net \ --cc=devicetree@vger.kernel.org \ --cc=gong.chen@linux.intel.com \ --cc=gregkh@linuxfoundation.org \ --cc=james.hogan@imgtec.com \ --cc=jkosina@suse.cz \ --cc=joe@perches.com \ --cc=kheitke@audience.com \ --cc=linux-arm-msm@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=mark.rutland@arm.com \ --cc=mathieu.poirier@linaro.org \ --cc=michael.opdenacker@free-electrons.com \ --cc=pawel.moll@arm.com \ --cc=poeschel@lemonage.de \ --cc=robh+dt@kernel.org \ --cc=sdharia@codeaurora.org \ --cc=sharon.dvir1@mail.huji.ac.il \ --cc=srinivas.kandagatla@linaro.org \ --cc=treding@nvidia.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: linkBe 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.