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

Configure Feed

Select the types of activity you want to include in your feed.

liveupdate: make unregister functions return void

Change liveupdate_unregister_file_handler and liveupdate_unregister_flb to
return void instead of an error code. This follows the design principle
that unregistration during module unload should not fail, as the unload
cannot be stopped at that point.

Link: https://lore.kernel.org/20260327033335.696621-10-pasha.tatashin@soleen.com
Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
Reviewed-by: Pratyush Yadav (Google) <pratyush@kernel.org>
Cc: David Matlack <dmatlack@google.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Samiullah Khawaja <skhawaja@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Pasha Tatashin and committed by
Andrew Morton
2ab7207e 07448800

+11 -28
+6 -8
include/linux/liveupdate.h
··· 231 231 int liveupdate_reboot(void); 232 232 233 233 int liveupdate_register_file_handler(struct liveupdate_file_handler *fh); 234 - int liveupdate_unregister_file_handler(struct liveupdate_file_handler *fh); 234 + void liveupdate_unregister_file_handler(struct liveupdate_file_handler *fh); 235 235 236 236 int liveupdate_register_flb(struct liveupdate_file_handler *fh, 237 237 struct liveupdate_flb *flb); 238 - int liveupdate_unregister_flb(struct liveupdate_file_handler *fh, 239 - struct liveupdate_flb *flb); 238 + void liveupdate_unregister_flb(struct liveupdate_file_handler *fh, 239 + struct liveupdate_flb *flb); 240 240 241 241 int liveupdate_flb_get_incoming(struct liveupdate_flb *flb, void **objp); 242 242 int liveupdate_flb_get_outgoing(struct liveupdate_flb *flb, void **objp); ··· 258 258 return -EOPNOTSUPP; 259 259 } 260 260 261 - static inline int liveupdate_unregister_file_handler(struct liveupdate_file_handler *fh) 261 + static inline void liveupdate_unregister_file_handler(struct liveupdate_file_handler *fh) 262 262 { 263 - return -EOPNOTSUPP; 264 263 } 265 264 266 265 static inline int liveupdate_register_flb(struct liveupdate_file_handler *fh, ··· 268 269 return -EOPNOTSUPP; 269 270 } 270 271 271 - static inline int liveupdate_unregister_flb(struct liveupdate_file_handler *fh, 272 - struct liveupdate_flb *flb) 272 + static inline void liveupdate_unregister_flb(struct liveupdate_file_handler *fh, 273 + struct liveupdate_flb *flb) 273 274 { 274 - return -EOPNOTSUPP; 275 275 } 276 276 277 277 static inline int liveupdate_flb_get_incoming(struct liveupdate_flb *flb,
+2 -12
kernel/liveupdate/luo_file.c
··· 912 912 * 913 913 * Unregisters the file handler from the liveupdate core. This function 914 914 * reverses the operations of liveupdate_register_file_handler(). 915 - * 916 - * It ensures safe removal by checking that: 917 - * No FLB registered with this file handler. 918 - * 919 - * If the unregistration fails, the internal test state is reverted. 920 - * 921 - * Return: 0 Success. -EOPNOTSUPP when live update is not enabled. -EBUSY A live 922 - * update is in progress, FLB is registred with this file handler. 923 915 */ 924 - int liveupdate_unregister_file_handler(struct liveupdate_file_handler *fh) 916 + void liveupdate_unregister_file_handler(struct liveupdate_file_handler *fh) 925 917 { 926 918 if (!liveupdate_enabled()) 927 - return -EOPNOTSUPP; 919 + return; 928 920 929 921 guard(rwsem_write)(&luo_register_rwlock); 930 922 luo_flb_unregister_all(fh); 931 923 list_del(&ACCESS_PRIVATE(fh, list)); 932 924 933 925 module_put(fh->ops->owner); 934 - 935 - return 0; 936 926 }
+3 -8
kernel/liveupdate/luo_flb.c
··· 475 475 * owner module (acquired during registration) is released. 476 476 * 477 477 * Context: It is typically called from a subsystem's module exit function. 478 - * Return: 0 on success. 479 - * -EOPNOTSUPP if live update is disabled. 480 - * -ENOENT if the FLB was not found in the file handler's list. 481 478 */ 482 - int liveupdate_unregister_flb(struct liveupdate_file_handler *fh, 483 - struct liveupdate_flb *flb) 479 + void liveupdate_unregister_flb(struct liveupdate_file_handler *fh, 480 + struct liveupdate_flb *flb) 484 481 { 485 482 if (!liveupdate_enabled()) 486 - return -EOPNOTSUPP; 483 + return; 487 484 488 485 guard(rwsem_write)(&luo_register_rwlock); 489 486 490 487 luo_flb_unregister_one(fh, flb); 491 - 492 - return 0; 493 488 } 494 489 495 490 /**