All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: "Opensource [Steve Twiss]" <stwiss.opensource@diasemi.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
	LINUXKERNEL <linux-kernel@vger.kernel.org>,
	RTC-LINUX <rtc-linux@googlegroups.com>,
	David Dajun Chen <david.chen@diasemi.com>,
	Support Opensource <Support.Opensource@diasemi.com>
Subject: [rtc-linux] Re: [PATCH V1] rtc: da9063: access ordering error during RTC interrupt system power on
Date: Thu, 17 Dec 2015 12:44:39 +0100	[thread overview]
Message-ID: <20151217114439.GF13078@piout.net> (raw)
In-Reply-To: <6ED8E3B22081A4459DAC7699F3695FB70173D28DCB@SW-EX-MBX02.diasemi.com>

On 17/12/2015 at 11:37:06 +0000, Opensource [Steve Twiss] wrote :
> On 16 December 2015 23:47 Alexandre Belloni wrote:
> > Subject: Re: [PATCH V1] rtc: da9063: access ordering error during RTC interrupt system power on
> > 
> > This seems mostly fine, however ...
> 
> Hi Alexandre,
> Thanks for reviewing this.
> 
> > On 08/12/2015 at 16:28:39 +0000, Steve Twiss wrote :
> > >  	irq_alarm = platform_get_irq_byname(pdev, "ALARM");
> > >  	ret = devm_request_threaded_irq(&pdev->dev, irq_alarm, NULL,
> > >  					da9063_alarm_event,
> > >  					IRQF_TRIGGER_LOW |
> > IRQF_ONESHOT,
> > >  					"ALARM", rtc);
> > > -	if (ret) {
> > > +	if (ret)
> > >  		dev_err(&pdev->dev, "Failed to request ALARM IRQ %d:
> > %d\n",
> > >  			irq_alarm, ret);
> > > -		return ret;
> > > -	}
> > > -
> > 
> > ... now that requesting the interrupt is optional, you probably want to
> > prevent userspace from thinking it will get an interrupt after setting
> > the alarm by returning -EINVAL in da9063_rtc_read_alarm() and
> > da9063_rtc_set_alarm() in that case.
> > 
> 
> .. I'm not quite certain I understand.
> Does the patch looks worse that it is?
> This part,
> 
> +	if (ret)
> 		dev_err(&pdev->dev, "Failed to request ALARM IRQ %d: %d\n",
> 			irq_alarm, ret);
>  -		return ret;
> 
> looks like it has erased the return ret,
> 
> > 
> > > -	rtc->rtc_dev = devm_rtc_device_register(&pdev->dev,
> > DA9063_DRVNAME_RTC,
> > > -					   &da9063_rtc_ops, THIS_MODULE);
> > > -	if (IS_ERR(rtc->rtc_dev))
> > > -		return PTR_ERR(rtc->rtc_dev);
> > >
> > > -	da9063_data_to_tm(data, &rtc->alarm_time, rtc);
> > > -	rtc->rtc_sync = false;
> > >  	return ret;
> 
> But it does exist at the end of the patch.
> So there will still be an error sent if the IRQ is not requested properly.
> Is this what you meant in your previous e-mail?
> 

Indeed, you are right, I'll apply that patch.


-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

WARNING: multiple messages have this Message-ID (diff)
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: "Opensource [Steve Twiss]" <stwiss.opensource@diasemi.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
	LINUXKERNEL <linux-kernel@vger.kernel.org>,
	RTC-LINUX <rtc-linux@googlegroups.com>,
	David Dajun Chen <david.chen@diasemi.com>,
	Support Opensource <Support.Opensource@diasemi.com>
Subject: Re: [PATCH V1] rtc: da9063: access ordering error during RTC interrupt system power on
Date: Thu, 17 Dec 2015 12:44:39 +0100	[thread overview]
Message-ID: <20151217114439.GF13078@piout.net> (raw)
In-Reply-To: <6ED8E3B22081A4459DAC7699F3695FB70173D28DCB@SW-EX-MBX02.diasemi.com>

On 17/12/2015 at 11:37:06 +0000, Opensource [Steve Twiss] wrote :
> On 16 December 2015 23:47 Alexandre Belloni wrote:
> > Subject: Re: [PATCH V1] rtc: da9063: access ordering error during RTC interrupt system power on
> > 
> > This seems mostly fine, however ...
> 
> Hi Alexandre,
> Thanks for reviewing this.
> 
> > On 08/12/2015 at 16:28:39 +0000, Steve Twiss wrote :
> > >  	irq_alarm = platform_get_irq_byname(pdev, "ALARM");
> > >  	ret = devm_request_threaded_irq(&pdev->dev, irq_alarm, NULL,
> > >  					da9063_alarm_event,
> > >  					IRQF_TRIGGER_LOW |
> > IRQF_ONESHOT,
> > >  					"ALARM", rtc);
> > > -	if (ret) {
> > > +	if (ret)
> > >  		dev_err(&pdev->dev, "Failed to request ALARM IRQ %d:
> > %d\n",
> > >  			irq_alarm, ret);
> > > -		return ret;
> > > -	}
> > > -
> > 
> > ... now that requesting the interrupt is optional, you probably want to
> > prevent userspace from thinking it will get an interrupt after setting
> > the alarm by returning -EINVAL in da9063_rtc_read_alarm() and
> > da9063_rtc_set_alarm() in that case.
> > 
> 
> .. I'm not quite certain I understand.
> Does the patch looks worse that it is?
> This part,
> 
> +	if (ret)
> 		dev_err(&pdev->dev, "Failed to request ALARM IRQ %d: %d\n",
> 			irq_alarm, ret);
>  -		return ret;
> 
> looks like it has erased the return ret,
> 
> > 
> > > -	rtc->rtc_dev = devm_rtc_device_register(&pdev->dev,
> > DA9063_DRVNAME_RTC,
> > > -					   &da9063_rtc_ops, THIS_MODULE);
> > > -	if (IS_ERR(rtc->rtc_dev))
> > > -		return PTR_ERR(rtc->rtc_dev);
> > >
> > > -	da9063_data_to_tm(data, &rtc->alarm_time, rtc);
> > > -	rtc->rtc_sync = false;
> > >  	return ret;
> 
> But it does exist at the end of the patch.
> So there will still be an error sent if the IRQ is not requested properly.
> Is this what you meant in your previous e-mail?
> 

Indeed, you are right, I'll apply that patch.


-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

  reply	other threads:[~2015-12-17 11:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-08 16:28 [rtc-linux] [PATCH V1] rtc: da9063: access ordering error during RTC interrupt system power on Steve Twiss
2015-12-08 16:28 ` Steve Twiss
2015-12-16 23:47 ` [rtc-linux] " Alexandre Belloni
2015-12-16 23:47   ` Alexandre Belloni
2015-12-17 11:37   ` [rtc-linux] " Opensource [Steve Twiss]
2015-12-17 11:37     ` Opensource [Steve Twiss]
2015-12-17 11:44     ` Alexandre Belloni [this message]
2015-12-17 11:44       ` Alexandre Belloni
2015-12-21  8:19 ` [rtc-linux] " Alexandre Belloni
2015-12-21  8:19   ` Alexandre Belloni

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=20151217114439.GF13078@piout.net \
    --to=alexandre.belloni@free-electrons.com \
    --cc=Support.Opensource@diasemi.com \
    --cc=a.zummo@towertech.it \
    --cc=david.chen@diasemi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rtc-linux@googlegroups.com \
    --cc=stwiss.opensource@diasemi.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 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.