Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rtc: efi: Remove wakeup functionality

The EFI rtc driver is used by non-x86 architectures only, and exposes
the get/set wakeup time functionality provided by the underlying
platform. This is usually broken on most platforms, and not widely used
to begin with [if at all], so let's just remove it.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Tested-by: Feng Tang <feng.tang@linux.alibaba.com>
Link: https://lore.kernel.org/r/20250714060843.4029171-6-ardb+git@google.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

authored by

Ard Biesheuvel and committed by
Alexandre Belloni
18a3510b a6f1a4f0

+2 -74
+2 -74
drivers/rtc/rtc-efi.c
··· 112 112 return true; 113 113 } 114 114 115 - static int efi_read_alarm(struct device *dev, struct rtc_wkalrm *wkalrm) 116 - { 117 - efi_time_t eft; 118 - efi_status_t status; 119 - 120 - /* 121 - * As of EFI v1.10, this call always returns an unsupported status 122 - */ 123 - status = efi.get_wakeup_time((efi_bool_t *)&wkalrm->enabled, 124 - (efi_bool_t *)&wkalrm->pending, &eft); 125 - 126 - if (status != EFI_SUCCESS) 127 - return -EINVAL; 128 - 129 - if (!convert_from_efi_time(&eft, &wkalrm->time)) 130 - return -EIO; 131 - 132 - return rtc_valid_tm(&wkalrm->time); 133 - } 134 - 135 - static int efi_set_alarm(struct device *dev, struct rtc_wkalrm *wkalrm) 136 - { 137 - efi_time_t eft; 138 - efi_status_t status; 139 - 140 - convert_to_efi_time(&wkalrm->time, &eft); 141 - 142 - /* 143 - * XXX Fixme: 144 - * As of EFI 0.92 with the firmware I have on my 145 - * machine this call does not seem to work quite 146 - * right 147 - * 148 - * As of v1.10, this call always returns an unsupported status 149 - */ 150 - status = efi.set_wakeup_time((efi_bool_t)wkalrm->enabled, &eft); 151 - 152 - dev_warn(dev, "write status is %d\n", (int)status); 153 - 154 - return status == EFI_SUCCESS ? 0 : -EINVAL; 155 - } 156 - 157 115 static int efi_read_time(struct device *dev, struct rtc_time *tm) 158 116 { 159 117 efi_status_t status; ··· 146 188 147 189 static int efi_procfs(struct device *dev, struct seq_file *seq) 148 190 { 149 - efi_time_t eft, alm; 191 + efi_time_t eft; 150 192 efi_time_cap_t cap; 151 - efi_bool_t enabled, pending; 152 - struct rtc_device *rtc = dev_get_drvdata(dev); 153 193 154 194 memset(&eft, 0, sizeof(eft)); 155 - memset(&alm, 0, sizeof(alm)); 156 195 memset(&cap, 0, sizeof(cap)); 157 196 158 197 efi.get_time(&eft, &cap); 159 - efi.get_wakeup_time(&enabled, &pending, &alm); 160 198 161 199 seq_printf(seq, 162 200 "Time\t\t: %u:%u:%u.%09u\n" ··· 167 213 else 168 214 /* XXX fixme: convert to string? */ 169 215 seq_printf(seq, "Timezone\t: %u\n", eft.timezone); 170 - 171 - if (test_bit(RTC_FEATURE_ALARM, rtc->features)) { 172 - seq_printf(seq, 173 - "Alarm Time\t: %u:%u:%u.%09u\n" 174 - "Alarm Date\t: %u-%u-%u\n" 175 - "Alarm Daylight\t: %u\n" 176 - "Enabled\t\t: %s\n" 177 - "Pending\t\t: %s\n", 178 - alm.hour, alm.minute, alm.second, alm.nanosecond, 179 - alm.year, alm.month, alm.day, 180 - alm.daylight, 181 - enabled == 1 ? "yes" : "no", 182 - pending == 1 ? "yes" : "no"); 183 - 184 - if (alm.timezone == EFI_UNSPECIFIED_TIMEZONE) 185 - seq_puts(seq, "Timezone\t: unspecified\n"); 186 - else 187 - /* XXX fixme: convert to string? */ 188 - seq_printf(seq, "Timezone\t: %u\n", alm.timezone); 189 - } 190 216 191 217 /* 192 218 * now prints the capabilities ··· 183 249 static const struct rtc_class_ops efi_rtc_ops = { 184 250 .read_time = efi_read_time, 185 251 .set_time = efi_set_time, 186 - .read_alarm = efi_read_alarm, 187 - .set_alarm = efi_set_alarm, 188 252 .proc = efi_procfs, 189 253 }; 190 254 ··· 203 271 platform_set_drvdata(dev, rtc); 204 272 205 273 rtc->ops = &efi_rtc_ops; 206 - clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, rtc->features); 207 - if (efi_rt_services_supported(EFI_RT_SUPPORTED_WAKEUP_SERVICES)) 208 - set_bit(RTC_FEATURE_ALARM_WAKEUP_ONLY, rtc->features); 209 - else 210 - clear_bit(RTC_FEATURE_ALARM, rtc->features); 274 + clear_bit(RTC_FEATURE_ALARM, rtc->features); 211 275 212 276 device_init_wakeup(&dev->dev, true); 213 277