mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Brown <davidb@codeaurora.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Kenneth Heitke <kheitke@codeaurora.org>,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/6] platform-drivers: msm: add single-wire serial bus interface (SSBI) driver
Date: Wed, 06 Mar 2013 21:20:45 -0800	[thread overview]
Message-ID: <8yawqtjvl8y.fsf@huya.qualcomm.com> (raw)
In-Reply-To: <20130307013008.GA2910@kroah.com> (Greg Kroah-Hartman's message of "Thu, 7 Mar 2013 09:30:08 +0800")

Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:

> On Wed, Mar 06, 2013 at 04:29:42PM -0800, David Brown wrote:
>> +menu "Qualcomm MSM SSBI bus support"
>> +	depends on ARCH_MSM
>
> Why?

In the sense that ARCH_MSM are the only devices that ever were, or ever
will be made with this device.  It doesn't strictly depend on it, but do
we want to clutter the config for everything else.

>> +config MSM_SSBI
>> +	bool "Qualcomm Single-wire Serial Bus Interface (SSBI)"
>
> Why can't this be a module?

Without this device, the PMIC drivers won't work, regulators can't be
turned on, and most of the other devices won't work.  I can try if it
can still be made a module, and it might be good at exercising the
deferred probe mechanism.

So, a deeper question.  I've resent this driver with minimal change.
I've also made some other changes as patches afterwards.  Do we want
these squashed into a single patch, or the initial one (not authored by
me) followed by updates?

>> +#
>> +# Makefile for the MSM specific device drivers.
>
> MSM?
>
> No comment needed at all in this file :)

Thanks, missed this.  I think the original patch was using platform/msm,
and the minimalist comment almost made sense in that context.

>> +struct msm_ssbi {
>> +	struct device		*dev;
>> +	struct device		*slave;
>
> Really?  Two pointers to devices?  Why?  Shouldn't this have a struct
> device embedded in it instead of the dev member being a pointer?

I'll go through this more thoroughly and organize things better.

>> +static int ssbi_wait_mask(struct msm_ssbi *ssbi, u32 set_mask, u32 clr_mask)
>> +{
>> +	u32 timeout = SSBI_TIMEOUT_US;
>> +	u32 val;
>> +
>> +	while (timeout--) {
>> +		val = ssbi_readl(ssbi, SSBI2_STATUS);
>> +		if (((val & set_mask) == set_mask) && ((val & clr_mask) == 0))
>> +			return 0;
>> +		udelay(1);
>
> Busy loop?  Really?

I'm not sure what else to do here.  The controller is only slightly more
than a bit-banged bus.  I think the reason for the longer possibly delay
is because there is an arbiter (the PMIC is shared with the radio CPU).
I'll investigate further.

>> +	}
>> +
>> +	dev_err(ssbi->dev, "%s: timeout (status %x set_mask %x clr_mask %x)\n",
>> +		__func__, ssbi_readl(ssbi, SSBI2_STATUS), set_mask, clr_mask);
>
> Why polute the log with this?  What can a user do with it?

Nothing in fact, other than possibly learn that things, indeed aren't
working.  I'll take it and the others out.

>> +static int
>> +msm_ssbi_write_bytes(struct msm_ssbi *ssbi, u16 addr, u8 *buf, int len)
>> +{
>> +	int ret = 0;
>> +
>> +	if (ssbi->controller_type == MSM_SBI_CTRL_SSBI2) {
>> +		u32 mode2 = ssbi_readl(ssbi, SSBI2_MODE2);
>> +		mode2 = SET_SSBI_MODE2_REG_ADDR_15_8(mode2, addr);
>> +		ssbi_writel(ssbi, mode2, SSBI2_MODE2);
>> +	}
>
> Perhaps have a controller type write function that can handle this type
> of stuff instead of putting it in the "generic" write path?

Yes, that's a better approach.

>> +EXPORT_SYMBOL(msm_ssbi_read);
>
> msm_*?  Why not just ssbi_*?

I'm fine with ssbi.  It is very MSM specific, though.

> EXPORT_SYMBOL_GPL()?

Yes, it's definitely a kernel internal API.

>> +static struct platform_driver msm_ssbi_driver = {
>> +	.probe		= msm_ssbi_probe,
>> +	.remove		= __exit_p(msm_ssbi_remove),
>
> You just oopsed if someone unbound your device from the driver from
> userspace.  Not good.

I did catch this one in a later patch :-)  I can clean it up in the
driver, though, since it looks like some more work needs to go into
this.

Thanks,
David

-- 
sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

  reply	other threads:[~2013-03-07  5:20 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-07  0:29 [PATCH 0/6] Qualcomm SSBI bus driver David Brown
2013-03-07  0:29 ` [PATCH 1/6] platform-drivers: msm: add single-wire serial bus interface (SSBI) driver David Brown
2013-03-07  1:30   ` Greg Kroah-Hartman
2013-03-07  5:20     ` David Brown [this message]
2013-03-07  6:01       ` Greg Kroah-Hartman
2013-03-07 10:05         ` Sekhar Nori
2013-03-07 18:45           ` David Brown
2013-03-07 18:50         ` David Brown
2013-03-07 23:29           ` Greg Kroah-Hartman
2013-03-12  6:51     ` David Brown
2013-03-12 13:27       ` Greg Kroah-Hartman
2013-03-07  0:29 ` [PATCH 2/6] SSBI: Convert SSBI to device tree David Brown
2013-03-07  0:29 ` [PATCH 3/6] ssbi: Fix exit mismatch in remove function David Brown
2013-03-07  1:30   ` Greg Kroah-Hartman
2013-03-07  5:21     ` David Brown
2013-03-07  0:29 ` [PATCH 4/6] ssbi: Use regular init level David Brown
2013-03-07  0:29 ` [PATCH 5/6] ARM: msm: enable SSBI driver in defconfig David Brown
2013-03-07  0:29 ` [PATCH 6/6] RFC: SSBI: Simple pm8058 test driver David Brown
2013-03-12 18:41 ` [PATCH v2 0/11] Qualcomm SSBI bus driver David Brown
2013-03-12 18:41   ` [PATCH v2 01/11] platform-drivers: msm: add single-wire serial bus interface (SSBI) driver David Brown
2013-03-12 18:41   ` [PATCH v2 02/11] fix: Use EXPORT_SYMBOL_GPL David Brown
2013-03-12 18:41   ` [PATCH v2 03/11] ssbi: Fix exit mismatch in remove function David Brown
2013-03-12 18:41   ` [PATCH v2 04/11] ssbi: Allow compilation as a module David Brown
2013-03-12 18:41   ` [PATCH v2 05/11] SSBI: Convert SSBI to device tree David Brown
2013-03-12 20:46     ` Stephen Boyd
2013-03-12 18:41   ` [PATCH v2 06/11] ssbi: Comment the use of udelay() David Brown
2013-03-12 18:41   ` [PATCH v2 07/11] ssbi: Use regular init level David Brown
2013-03-12 20:26     ` Stephen Boyd
2013-03-12 18:41   ` [PATCH v2 08/11] ssbi: Remove extraneous logging David Brown
2013-03-12 18:41   ` [PATCH v2 09/11] SSBI: Remove MSM_ prefix from SSBI drivers David Brown
2013-03-12 18:41   ` [PATCH v2 10/11] MAINTAINERS: add ssbi David Brown
2013-03-25 17:40   ` [PATCH v2 0/11] Qualcomm SSBI bus driver Greg Kroah-Hartman
2013-03-12 20:12 ` [PATCH v2 11/11] RFC: SSBI: Simple pm8058 test driver David Brown

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=8yawqtjvl8y.fsf@huya.qualcomm.com \
    --to=davidb@codeaurora.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kheitke@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®