aboutsummaryrefslogtreecommitdiff
path: root/drivers/rtc
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@google.com>2018-05-02 11:14:06 -0700
committerGreg Kroah-Hartman <gregkh@google.com>2018-05-02 11:14:06 -0700
commitf679e4d9b77a87c155179c15a7c158038042cfe3 (patch)
tree132efb30d6cf9dcc8c245781d12e0068df5bd369 /drivers/rtc
parent1321d422617691b1bf56d1486436c1f10f2abb80 (diff)
parenteff40cb1908ba6ba604068d6273584fc28e3bac8 (diff)
Merge 4.9.98 into android-4.9
Changes in 4.9.98 ext4: prevent right-shifting extents beyond EXT_MAX_BLOCKS ext4: set h_journal if there is a failure starting a reserved handle ext4: add validity checks for bitmap block numbers ext4: fix bitmap position validation random: set up the NUMA crng instances after the CRNG is fully initialized random: fix possible sleeping allocation from irq context random: rate limit unseeded randomness warnings usbip: usbip_event: fix to not print kernel pointer address usbip: usbip_host: fix to hold parent lock for device_attach() calls usbip: vhci_hcd: Fix usb device and sockfd leaks USB: serial: simple: add libtransistor console USB: serial: ftdi_sio: use jtag quirk for Arrow USB Blaster USB: serial: cp210x: add ID for NI USB serial console usb: core: Add quirk for HP v222w 16GB Mini USB: Increment wakeup count on remote wakeup. ALSA: usb-audio: Skip broken EU on Dell dock USB-audio virtio: add ability to iterate over vqs virtio_console: free buffers after reset drm/virtio: fix vq wait_event condition tty: Don't call panic() at tty_ldisc_init() tty: n_gsm: Fix long delays with control frame timeouts in ADM mode tty: n_gsm: Fix DLCI handling for ADM mode if debug & 2 is not set tty: Use __GFP_NOFAIL for tty_ldisc_get() ALSA: dice: fix OUI for TC group ALSA: dice: fix error path to destroy initialized stream data ALSA: opl3: Hardening for potential Spectre v1 ALSA: asihpi: Hardening for potential Spectre v1 ALSA: hdspm: Hardening for potential Spectre v1 ALSA: rme9652: Hardening for potential Spectre v1 ALSA: control: Hardening for potential Spectre v1 ALSA: core: Report audio_tstamp in snd_pcm_sync_ptr ALSA: seq: oss: Fix unbalanced use lock for synth MIDI device ALSA: seq: oss: Hardening for potential Spectre v1 ALSA: hda: Hardening for potential Spectre v1 ALSA: hda/realtek - Add some fixes for ALC233 mtd: cfi: cmdset_0001: Do not allow read/write to suspend erase block. mtd: cfi: cmdset_0001: Workaround Micron Erase suspend bug. mtd: cfi: cmdset_0002: Do not allow read/write to suspend erase block. kobject: don't use WARN for registration failures scsi: sd: Defer spinning up drive while SANITIZE is in progress PCI: aardvark: Fix logic in advk_pcie_{rd,wr}_conf() PCI: aardvark: Set PIO_ADDR_LS correctly in advk_pcie_rd_conf() PCI: aardvark: Fix PCIe Max Read Request Size setting ARM: amba: Make driver_override output consistent with other buses ARM: amba: Fix race condition with driver_override ARM: amba: Don't read past the end of sysfs "driver_override" buffer crypto: drbg - set freed buffers to NULL ASoC: fsl_esai: Fix divisor calculation failure at lower ratio libceph: un-backoff on tick when we have a authenticated session libceph: reschedule a tick in finish_hunting() libceph: validate con->state at the top of try_write() earlycon: Use a pointer table to fix __earlycon_table stride cpufreq: powernv: Fix hardlockup due to synchronous smp_call in timer interrupt rtc: opal: Fix OPAL RTC driver OPAL_BUSY loops drm/amdgpu: set COMPUTE_PGM_RSRC1 for SGPR/VGPR clearing shaders objtool, perf: Fix GCC 8 -Wrestrict error tools/lib/subcmd/pager.c: do not alias select() params x86/ipc: Fix x32 version of shmid64_ds and msqid64_ds x86/smpboot: Don't use mwait_play_dead() on AMD systems x86/microcode/intel: Save microcode patch unconditionally powerpc/eeh: Fix race with driver un/bind Linux 4.9.98 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-opal.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/drivers/rtc/rtc-opal.c b/drivers/rtc/rtc-opal.c
index aa53fceaa5e0..180ec1f8c917 100644
--- a/drivers/rtc/rtc-opal.c
+++ b/drivers/rtc/rtc-opal.c
@@ -57,7 +57,7 @@ static void tm_to_opal(struct rtc_time *tm, u32 *y_m_d, u64 *h_m_s_ms)
static int opal_get_rtc_time(struct device *dev, struct rtc_time *tm)
{
- long rc = OPAL_BUSY;
+ s64 rc = OPAL_BUSY;
int retries = 10;
u32 y_m_d;
u64 h_m_s_ms;
@@ -66,13 +66,17 @@ static int opal_get_rtc_time(struct device *dev, struct rtc_time *tm)
while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) {
rc = opal_rtc_read(&__y_m_d, &__h_m_s_ms);
- if (rc == OPAL_BUSY_EVENT)
+ if (rc == OPAL_BUSY_EVENT) {
+ msleep(OPAL_BUSY_DELAY_MS);
opal_poll_events(NULL);
- else if (retries-- && (rc == OPAL_HARDWARE
- || rc == OPAL_INTERNAL_ERROR))
- msleep(10);
- else if (rc != OPAL_BUSY && rc != OPAL_BUSY_EVENT)
- break;
+ } else if (rc == OPAL_BUSY) {
+ msleep(OPAL_BUSY_DELAY_MS);
+ } else if (rc == OPAL_HARDWARE || rc == OPAL_INTERNAL_ERROR) {
+ if (retries--) {
+ msleep(10); /* Wait 10ms before retry */
+ rc = OPAL_BUSY; /* go around again */
+ }
+ }
}
if (rc != OPAL_SUCCESS)
@@ -87,21 +91,26 @@ static int opal_get_rtc_time(struct device *dev, struct rtc_time *tm)
static int opal_set_rtc_time(struct device *dev, struct rtc_time *tm)
{
- long rc = OPAL_BUSY;
+ s64 rc = OPAL_BUSY;
int retries = 10;
u32 y_m_d = 0;
u64 h_m_s_ms = 0;
tm_to_opal(tm, &y_m_d, &h_m_s_ms);
+
while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) {
rc = opal_rtc_write(y_m_d, h_m_s_ms);
- if (rc == OPAL_BUSY_EVENT)
+ if (rc == OPAL_BUSY_EVENT) {
+ msleep(OPAL_BUSY_DELAY_MS);
opal_poll_events(NULL);
- else if (retries-- && (rc == OPAL_HARDWARE
- || rc == OPAL_INTERNAL_ERROR))
- msleep(10);
- else if (rc != OPAL_BUSY && rc != OPAL_BUSY_EVENT)
- break;
+ } else if (rc == OPAL_BUSY) {
+ msleep(OPAL_BUSY_DELAY_MS);
+ } else if (rc == OPAL_HARDWARE || rc == OPAL_INTERNAL_ERROR) {
+ if (retries--) {
+ msleep(10); /* Wait 10ms before retry */
+ rc = OPAL_BUSY; /* go around again */
+ }
+ }
}
return rc == OPAL_SUCCESS ? 0 : -EIO;