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

Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Conflicts:

drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
6e9d51b1a5cb ("net/mlx5e: Initialize link speed to zero")
1bffcea42926 ("net/mlx5e: Add devlink hairpin queues parameters")
https://lore.kernel.org/all/20230324120623.4ebbc66f@canb.auug.org.au/
https://lore.kernel.org/all/20230321211135.47711-1-saeed@kernel.org/

Adjacent changes:

drivers/net/phy/phy.c
323fe43cf9ae ("net: phy: Improved PHY error reporting in state machine")
4203d84032e2 ("net: phy: Ensure state transitions are processed from phy_stop()")

Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+2233 -2848
+1
.gitignore
··· 78 78 # RPM spec file (make rpm-pkg) 79 79 # 80 80 /*.spec 81 + /rpmbuild/ 81 82 82 83 # 83 84 # Debian directory (make deb-pkg)
+5 -2
Documentation/networking/xdp-rx-metadata.rst
··· 23 23 An XDP program can use these kfuncs to read the metadata into stack 24 24 variables for its own consumption. Or, to pass the metadata on to other 25 25 consumers, an XDP program can store it into the metadata area carried 26 - ahead of the packet. 26 + ahead of the packet. Not all packets will necessary have the requested 27 + metadata available in which case the driver returns ``-ENODATA``. 27 28 28 29 Not all kfuncs have to be implemented by the device driver; when not 29 - implemented, the default ones that return ``-EOPNOTSUPP`` will be used. 30 + implemented, the default ones that return ``-EOPNOTSUPP`` will be used 31 + to indicate the device driver have not implemented this kfunc. 32 + 30 33 31 34 Within an XDP frame, the metadata layout (accessed via ``xdp_buff``) is 32 35 as follows::
+1 -3
MAINTAINERS
··· 19157 19157 F: drivers/net/ethernet/sis/sis900.* 19158 19158 19159 19159 SIS FRAMEBUFFER DRIVER 19160 - M: Thomas Winischhofer <thomas@winischhofer.net> 19161 - S: Maintained 19162 - W: http://www.winischhofer.net/linuxsisvga.shtml 19160 + S: Orphan 19163 19161 F: Documentation/fb/sisfb.rst 19164 19162 F: drivers/video/fbdev/sis/ 19165 19163 F: include/video/sisfb.h
+5 -8
Makefile
··· 2 2 VERSION = 6 3 3 PATCHLEVEL = 3 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc2 5 + EXTRAVERSION = -rc3 6 6 NAME = Hurr durr I'ma ninja sloth 7 7 8 8 # *DOCUMENTATION* ··· 274 274 cscope gtags TAGS tags help% %docs check% coccicheck \ 275 275 $(version_h) headers headers_% archheaders archscripts \ 276 276 %asm-generic kernelversion %src-pkg dt_binding_check \ 277 - outputmakefile rustavailable rustfmt rustfmtcheck \ 278 - scripts_package 277 + outputmakefile rustavailable rustfmt rustfmtcheck 279 278 # Installation targets should not require compiler. Unfortunately, vdso_install 280 279 # is an exception where build artifacts may be updated. This must be fixed. 281 280 no-compiler-targets := $(no-dot-config-targets) install dtbs_install \ ··· 1604 1605 certs/signing_key.pem \ 1605 1606 certs/x509.genkey \ 1606 1607 vmlinux-gdb.py \ 1607 - *.spec \ 1608 + *.spec rpmbuild \ 1608 1609 rust/libmacros.so 1609 1610 1610 1611 # clean - Delete most, but leave enough to build external modules ··· 1654 1655 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.package $@ 1655 1656 %pkg: include/config/kernel.release FORCE 1656 1657 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.package $@ 1657 - 1658 - PHONY += scripts_package 1659 - scripts_package: scripts_basic 1660 - $(Q)$(MAKE) $(build)=scripts scripts/list-gitignored 1661 1658 1662 1659 # Brief documentation of the typical targets used 1663 1660 # --------------------------------------------------------------------------- ··· 1880 1885 endif 1881 1886 1882 1887 else # KBUILD_EXTMOD 1888 + 1889 + filechk_kernel.release = echo $(KERNELRELEASE) 1883 1890 1884 1891 ### 1885 1892 # External module support.
+2 -2
arch/arm/lib/uaccess_with_memcpy.c
··· 116 116 tocopy = n; 117 117 118 118 ua_flags = uaccess_save_and_enable(); 119 - memcpy((void *)to, from, tocopy); 119 + __memcpy((void *)to, from, tocopy); 120 120 uaccess_restore(ua_flags); 121 121 to += tocopy; 122 122 from += tocopy; ··· 178 178 tocopy = n; 179 179 180 180 ua_flags = uaccess_save_and_enable(); 181 - memset((void *)addr, 0, tocopy); 181 + __memset((void *)addr, 0, tocopy); 182 182 uaccess_restore(ua_flags); 183 183 addr += tocopy; 184 184 n -= tocopy;
+2 -1
arch/x86/include/asm/sev-common.h
··· 128 128 struct psc_entry entries[VMGEXIT_PSC_MAX_ENTRY]; 129 129 } __packed; 130 130 131 - /* Guest message request error code */ 131 + /* Guest message request error codes */ 132 132 #define SNP_GUEST_REQ_INVALID_LEN BIT_ULL(32) 133 + #define SNP_GUEST_REQ_ERR_BUSY BIT_ULL(33) 133 134 134 135 #define GHCB_MSR_TERM_REQ 0x100 135 136 #define GHCB_MSR_TERM_REASON_SET_POS 12
+1
arch/x86/kernel/cpu/mce/core.c
··· 2355 2355 { 2356 2356 mce_timer_delete_all(); 2357 2357 on_each_cpu(mce_cpu_restart, NULL, 1); 2358 + mce_schedule_work(); 2358 2359 } 2359 2360 2360 2361 /* Toggle features for corrected errors */
+2 -5
arch/x86/kernel/cpu/resctrl/ctrlmondata.c
··· 368 368 { 369 369 struct resctrl_schema *s; 370 370 struct rdtgroup *rdtgrp; 371 - struct rdt_domain *dom; 372 371 struct rdt_resource *r; 373 372 char *tok, *resname; 374 373 int ret = 0; ··· 396 397 goto out; 397 398 } 398 399 399 - list_for_each_entry(s, &resctrl_schema_all, list) { 400 - list_for_each_entry(dom, &s->res->domains, list) 401 - memset(dom->staged_config, 0, sizeof(dom->staged_config)); 402 - } 400 + rdt_staged_configs_clear(); 403 401 404 402 while ((tok = strsep(&buf, "\n")) != NULL) { 405 403 resname = strim(strsep(&tok, ":")); ··· 441 445 } 442 446 443 447 out: 448 + rdt_staged_configs_clear(); 444 449 rdtgroup_kn_unlock(of->kn); 445 450 cpus_read_unlock(); 446 451 return ret ?: nbytes;
+1
arch/x86/kernel/cpu/resctrl/internal.h
··· 555 555 void rdt_domain_reconfigure_cdp(struct rdt_resource *r); 556 556 void __init thread_throttle_mode_init(void); 557 557 void __init mbm_config_rftype_init(const char *config); 558 + void rdt_staged_configs_clear(void); 558 559 559 560 #endif /* _ASM_X86_RESCTRL_INTERNAL_H */
+21 -4
arch/x86/kernel/cpu/resctrl/rdtgroup.c
··· 78 78 va_end(ap); 79 79 } 80 80 81 + void rdt_staged_configs_clear(void) 82 + { 83 + struct rdt_resource *r; 84 + struct rdt_domain *dom; 85 + 86 + lockdep_assert_held(&rdtgroup_mutex); 87 + 88 + for_each_alloc_capable_rdt_resource(r) { 89 + list_for_each_entry(dom, &r->domains, list) 90 + memset(dom->staged_config, 0, sizeof(dom->staged_config)); 91 + } 92 + } 93 + 81 94 /* 82 95 * Trivial allocator for CLOSIDs. Since h/w only supports a small number, 83 96 * we can keep a bitmap of free CLOSIDs in a single integer. ··· 3120 3107 { 3121 3108 struct resctrl_schema *s; 3122 3109 struct rdt_resource *r; 3123 - int ret; 3110 + int ret = 0; 3111 + 3112 + rdt_staged_configs_clear(); 3124 3113 3125 3114 list_for_each_entry(s, &resctrl_schema_all, list) { 3126 3115 r = s->res; ··· 3134 3119 } else { 3135 3120 ret = rdtgroup_init_cat(s, rdtgrp->closid); 3136 3121 if (ret < 0) 3137 - return ret; 3122 + goto out; 3138 3123 } 3139 3124 3140 3125 ret = resctrl_arch_update_domains(r, rdtgrp->closid); 3141 3126 if (ret < 0) { 3142 3127 rdt_last_cmd_puts("Failed to initialize allocations\n"); 3143 - return ret; 3128 + goto out; 3144 3129 } 3145 3130 3146 3131 } 3147 3132 3148 3133 rdtgrp->mode = RDT_MODE_SHAREABLE; 3149 3134 3150 - return 0; 3135 + out: 3136 + rdt_staged_configs_clear(); 3137 + return ret; 3151 3138 } 3152 3139 3153 3140 static int mkdir_rdt_prepare(struct kernfs_node *parent_kn,
+17 -9
arch/x86/kernel/sev.c
··· 2183 2183 struct ghcb *ghcb; 2184 2184 int ret; 2185 2185 2186 - if (!cc_platform_has(CC_ATTR_GUEST_SEV_SNP)) 2187 - return -ENODEV; 2188 - 2189 2186 if (!fw_err) 2190 2187 return -EINVAL; 2191 2188 ··· 2209 2212 if (ret) 2210 2213 goto e_put; 2211 2214 2212 - if (ghcb->save.sw_exit_info_2) { 2215 + *fw_err = ghcb->save.sw_exit_info_2; 2216 + switch (*fw_err) { 2217 + case 0: 2218 + break; 2219 + 2220 + case SNP_GUEST_REQ_ERR_BUSY: 2221 + ret = -EAGAIN; 2222 + break; 2223 + 2224 + case SNP_GUEST_REQ_INVALID_LEN: 2213 2225 /* Number of expected pages are returned in RBX */ 2214 - if (exit_code == SVM_VMGEXIT_EXT_GUEST_REQUEST && 2215 - ghcb->save.sw_exit_info_2 == SNP_GUEST_REQ_INVALID_LEN) 2226 + if (exit_code == SVM_VMGEXIT_EXT_GUEST_REQUEST) { 2216 2227 input->data_npages = ghcb_get_rbx(ghcb); 2217 - 2218 - *fw_err = ghcb->save.sw_exit_info_2; 2219 - 2228 + ret = -ENOSPC; 2229 + break; 2230 + } 2231 + fallthrough; 2232 + default: 2220 2233 ret = -EIO; 2234 + break; 2221 2235 } 2222 2236 2223 2237 e_put:
+2 -1
arch/x86/mm/mem_encrypt_identity.c
··· 600 600 cmdline_ptr = (const char *)((u64)bp->hdr.cmd_line_ptr | 601 601 ((u64)bp->ext_cmd_line_ptr << 32)); 602 602 603 - cmdline_find_option(cmdline_ptr, cmdline_arg, buffer, sizeof(buffer)); 603 + if (cmdline_find_option(cmdline_ptr, cmdline_arg, buffer, sizeof(buffer)) < 0) 604 + return; 604 605 605 606 if (!strncmp(buffer, cmdline_on, sizeof(buffer))) 606 607 sme_me_mask = me_mask;
+5 -5
crypto/asymmetric_keys/pkcs7_verify.c
··· 79 79 } 80 80 81 81 if (sinfo->msgdigest_len != sig->digest_size) { 82 - pr_debug("Sig %u: Invalid digest size (%u)\n", 83 - sinfo->index, sinfo->msgdigest_len); 82 + pr_warn("Sig %u: Invalid digest size (%u)\n", 83 + sinfo->index, sinfo->msgdigest_len); 84 84 ret = -EBADMSG; 85 85 goto error; 86 86 } 87 87 88 88 if (memcmp(sig->digest, sinfo->msgdigest, 89 89 sinfo->msgdigest_len) != 0) { 90 - pr_debug("Sig %u: Message digest doesn't match\n", 91 - sinfo->index); 90 + pr_warn("Sig %u: Message digest doesn't match\n", 91 + sinfo->index); 92 92 ret = -EKEYREJECTED; 93 93 goto error; 94 94 } ··· 478 478 const void *data, size_t datalen) 479 479 { 480 480 if (pkcs7->data) { 481 - pr_debug("Data already supplied\n"); 481 + pr_warn("Data already supplied\n"); 482 482 return -EINVAL; 483 483 } 484 484 pkcs7->data = data;
+18 -14
crypto/asymmetric_keys/verify_pefile.c
··· 74 74 break; 75 75 76 76 default: 77 - pr_debug("Unknown PEOPT magic = %04hx\n", pe32->magic); 77 + pr_warn("Unknown PEOPT magic = %04hx\n", pe32->magic); 78 78 return -ELIBBAD; 79 79 } 80 80 ··· 95 95 ctx->certs_size = ddir->certs.size; 96 96 97 97 if (!ddir->certs.virtual_address || !ddir->certs.size) { 98 - pr_debug("Unsigned PE binary\n"); 98 + pr_warn("Unsigned PE binary\n"); 99 99 return -ENODATA; 100 100 } 101 101 ··· 127 127 unsigned len; 128 128 129 129 if (ctx->sig_len < sizeof(wrapper)) { 130 - pr_debug("Signature wrapper too short\n"); 130 + pr_warn("Signature wrapper too short\n"); 131 131 return -ELIBBAD; 132 132 } 133 133 ··· 135 135 pr_debug("sig wrapper = { %x, %x, %x }\n", 136 136 wrapper.length, wrapper.revision, wrapper.cert_type); 137 137 138 - /* Both pesign and sbsign round up the length of certificate table 139 - * (in optional header data directories) to 8 byte alignment. 138 + /* sbsign rounds up the length of certificate table (in optional 139 + * header data directories) to 8 byte alignment. However, the PE 140 + * specification states that while entries are 8-byte aligned, this is 141 + * not included in their length, and as a result, pesign has not 142 + * rounded up since 0.110. 140 143 */ 141 - if (round_up(wrapper.length, 8) != ctx->sig_len) { 142 - pr_debug("Signature wrapper len wrong\n"); 144 + if (wrapper.length > ctx->sig_len) { 145 + pr_warn("Signature wrapper bigger than sig len (%x > %x)\n", 146 + ctx->sig_len, wrapper.length); 143 147 return -ELIBBAD; 144 148 } 145 149 if (wrapper.revision != WIN_CERT_REVISION_2_0) { 146 - pr_debug("Signature is not revision 2.0\n"); 150 + pr_warn("Signature is not revision 2.0\n"); 147 151 return -ENOTSUPP; 148 152 } 149 153 if (wrapper.cert_type != WIN_CERT_TYPE_PKCS_SIGNED_DATA) { 150 - pr_debug("Signature certificate type is not PKCS\n"); 154 + pr_warn("Signature certificate type is not PKCS\n"); 151 155 return -ENOTSUPP; 152 156 } 153 157 ··· 164 160 ctx->sig_offset += sizeof(wrapper); 165 161 ctx->sig_len -= sizeof(wrapper); 166 162 if (ctx->sig_len < 4) { 167 - pr_debug("Signature data missing\n"); 163 + pr_warn("Signature data missing\n"); 168 164 return -EKEYREJECTED; 169 165 } 170 166 ··· 198 194 return 0; 199 195 } 200 196 not_pkcs7: 201 - pr_debug("Signature data not PKCS#7\n"); 197 + pr_warn("Signature data not PKCS#7\n"); 202 198 return -ELIBBAD; 203 199 } 204 200 ··· 341 337 digest_size = crypto_shash_digestsize(tfm); 342 338 343 339 if (digest_size != ctx->digest_len) { 344 - pr_debug("Digest size mismatch (%zx != %x)\n", 345 - digest_size, ctx->digest_len); 340 + pr_warn("Digest size mismatch (%zx != %x)\n", 341 + digest_size, ctx->digest_len); 346 342 ret = -EBADMSG; 347 343 goto error_no_desc; 348 344 } ··· 373 369 * PKCS#7 certificate. 374 370 */ 375 371 if (memcmp(digest, ctx->digest, ctx->digest_len) != 0) { 376 - pr_debug("Digest mismatch\n"); 372 + pr_warn("Digest mismatch\n"); 377 373 ret = -EKEYREJECTED; 378 374 } else { 379 375 pr_debug("The digests match!\n");
+18 -14
drivers/ata/pata_parport/pata_parport.c
··· 381 381 { 382 382 struct pi_adapter *pi = container_of(dev, struct pi_adapter, dev); 383 383 384 + ida_free(&pata_parport_bus_dev_ids, dev->id); 384 385 kfree(pi); 385 386 } 386 387 ··· 434 433 if (bus_for_each_dev(&pata_parport_bus_type, NULL, &match, pi_find_dev)) 435 434 return NULL; 436 435 437 - pi = kzalloc(sizeof(struct pi_adapter), GFP_KERNEL); 438 - if (!pi) 436 + id = ida_alloc(&pata_parport_bus_dev_ids, GFP_KERNEL); 437 + if (id < 0) 439 438 return NULL; 439 + 440 + pi = kzalloc(sizeof(struct pi_adapter), GFP_KERNEL); 441 + if (!pi) { 442 + ida_free(&pata_parport_bus_dev_ids, id); 443 + return NULL; 444 + } 440 445 441 446 /* set up pi->dev before pi_probe_unit() so it can use dev_printk() */ 442 447 pi->dev.parent = &pata_parport_bus; 443 448 pi->dev.bus = &pata_parport_bus_type; 444 449 pi->dev.driver = &pr->driver; 445 450 pi->dev.release = pata_parport_dev_release; 446 - id = ida_alloc(&pata_parport_bus_dev_ids, GFP_KERNEL); 447 - if (id < 0) 448 - return NULL; /* pata_parport_dev_release will do kfree(pi) */ 449 451 pi->dev.id = id; 450 452 dev_set_name(&pi->dev, "pata_parport.%u", pi->dev.id); 451 453 if (device_register(&pi->dev)) { 452 454 put_device(&pi->dev); 453 - goto out_ida_free; 455 + /* pata_parport_dev_release will do ida_free(dev->id) and kfree(pi) */ 456 + return NULL; 454 457 } 455 458 456 459 pi->proto = pr; ··· 469 464 pi->port = parport->base; 470 465 471 466 par_cb.private = pi; 472 - pi->pardev = parport_register_dev_model(parport, DRV_NAME, &par_cb, 473 - pi->dev.id); 467 + pi->pardev = parport_register_dev_model(parport, DRV_NAME, &par_cb, id); 474 468 if (!pi->pardev) 475 469 goto out_module_put; 476 470 ··· 491 487 492 488 pi_connect(pi); 493 489 if (ata_host_activate(host, 0, NULL, 0, &pata_parport_sht)) 494 - goto out_unreg_parport; 490 + goto out_disconnect; 495 491 496 492 return pi; 497 493 498 - out_unreg_parport: 494 + out_disconnect: 499 495 pi_disconnect(pi); 496 + out_unreg_parport: 500 497 parport_unregister_device(pi->pardev); 501 498 if (pi->proto->release_proto) 502 499 pi->proto->release_proto(pi); ··· 505 500 module_put(pi->proto->owner); 506 501 out_unreg_dev: 507 502 device_unregister(&pi->dev); 508 - out_ida_free: 509 - ida_free(&pata_parport_bus_dev_ids, pi->dev.id); 503 + /* pata_parport_dev_release will do ida_free(dev->id) and kfree(pi) */ 510 504 return NULL; 511 505 } 512 506 ··· 630 626 pi_disconnect(pi); 631 627 pi_release(pi); 632 628 device_unregister(dev); 633 - ida_free(&pata_parport_bus_dev_ids, dev->id); 634 - /* pata_parport_dev_release will do kfree(pi) */ 629 + /* pata_parport_dev_release will do ida_free(dev->id) and kfree(pi) */ 635 630 } 636 631 637 632 static ssize_t delete_device_store(struct bus_type *bus, const char *buf, ··· 646 643 } 647 644 648 645 pi_remove_one(dev); 646 + put_device(dev); 649 647 mutex_unlock(&pi_mutex); 650 648 651 649 return count;
+11
drivers/atm/idt77252.c
··· 2909 2909 2910 2910 recycle_rx_pool_skb(card, &vc->rcv.rx_pool); 2911 2911 } 2912 + kfree(vc); 2912 2913 } 2913 2914 } 2914 2915 } ··· 2951 2950 clear_bit(VCF_IDLE, &vc->flags); 2952 2951 writel(TCMDQ_START | 0, SAR_REG_TCMDQ); 2953 2952 return 0; 2953 + } 2954 + 2955 + static void 2956 + close_card_ubr0(struct idt77252_dev *card) 2957 + { 2958 + struct vc_map *vc = card->vcs[0]; 2959 + 2960 + free_scq(card, vc->scq); 2961 + kfree(vc); 2954 2962 } 2955 2963 2956 2964 static int ··· 3011 3001 struct idt77252_dev *card = dev->dev_data; 3012 3002 u32 conf; 3013 3003 3004 + close_card_ubr0(card); 3014 3005 close_card_oam(card); 3015 3006 3016 3007 conf = SAR_CFG_RXPTH | /* enable receive path */
+33 -18
drivers/bluetooth/btintel.c
··· 26 26 #define ECDSA_HEADER_LEN 320 27 27 28 28 #define BTINTEL_PPAG_NAME "PPAG" 29 - #define BTINTEL_PPAG_PREFIX "\\_SB_.PCI0.XHCI.RHUB" 29 + 30 + /* structure to store the PPAG data read from ACPI table */ 31 + struct btintel_ppag { 32 + u32 domain; 33 + u32 mode; 34 + acpi_status status; 35 + struct hci_dev *hdev; 36 + }; 30 37 31 38 #define CMD_WRITE_BOOT_PARAMS 0xfc0e 32 39 struct cmd_write_boot_params { ··· 1302 1295 1303 1296 status = acpi_get_name(handle, ACPI_FULL_PATHNAME, &string); 1304 1297 if (ACPI_FAILURE(status)) { 1305 - bt_dev_warn(hdev, "ACPI Failure: %s", acpi_format_exception(status)); 1298 + bt_dev_warn(hdev, "PPAG-BT: ACPI Failure: %s", acpi_format_exception(status)); 1306 1299 return status; 1307 1300 } 1308 1301 1309 - if (strncmp(BTINTEL_PPAG_PREFIX, string.pointer, 1310 - strlen(BTINTEL_PPAG_PREFIX))) { 1302 + len = strlen(string.pointer); 1303 + if (len < strlen(BTINTEL_PPAG_NAME)) { 1311 1304 kfree(string.pointer); 1312 1305 return AE_OK; 1313 1306 } 1314 1307 1315 - len = strlen(string.pointer); 1316 1308 if (strncmp((char *)string.pointer + len - 4, BTINTEL_PPAG_NAME, 4)) { 1317 1309 kfree(string.pointer); 1318 1310 return AE_OK; ··· 1320 1314 1321 1315 status = acpi_evaluate_object(handle, NULL, NULL, &buffer); 1322 1316 if (ACPI_FAILURE(status)) { 1323 - bt_dev_warn(hdev, "ACPI Failure: %s", acpi_format_exception(status)); 1317 + ppag->status = status; 1318 + bt_dev_warn(hdev, "PPAG-BT: ACPI Failure: %s", acpi_format_exception(status)); 1324 1319 return status; 1325 1320 } 1326 1321 ··· 1330 1323 1331 1324 if (p->type != ACPI_TYPE_PACKAGE || p->package.count != 2) { 1332 1325 kfree(buffer.pointer); 1333 - bt_dev_warn(hdev, "Invalid object type: %d or package count: %d", 1326 + bt_dev_warn(hdev, "PPAG-BT: Invalid object type: %d or package count: %d", 1334 1327 p->type, p->package.count); 1328 + ppag->status = AE_ERROR; 1335 1329 return AE_ERROR; 1336 1330 } 1337 1331 ··· 1343 1335 1344 1336 ppag->domain = (u32)p->package.elements[0].integer.value; 1345 1337 ppag->mode = (u32)p->package.elements[1].integer.value; 1338 + ppag->status = AE_OK; 1346 1339 kfree(buffer.pointer); 1347 1340 return AE_CTRL_TERMINATE; 1348 1341 } ··· 2323 2314 2324 2315 static void btintel_set_ppag(struct hci_dev *hdev, struct intel_version_tlv *ver) 2325 2316 { 2326 - acpi_status status; 2327 2317 struct btintel_ppag ppag; 2328 2318 struct sk_buff *skb; 2329 2319 struct btintel_loc_aware_reg ppag_cmd; 2320 + acpi_handle handle; 2330 2321 2331 - /* PPAG is not supported if CRF is HrP2, Jfp2, JfP1 */ 2322 + /* PPAG is not supported if CRF is HrP2, Jfp2, JfP1 */ 2332 2323 switch (ver->cnvr_top & 0xFFF) { 2333 2324 case 0x504: /* Hrp2 */ 2334 2325 case 0x202: /* Jfp2 */ ··· 2336 2327 return; 2337 2328 } 2338 2329 2330 + handle = ACPI_HANDLE(GET_HCIDEV_DEV(hdev)); 2331 + if (!handle) { 2332 + bt_dev_info(hdev, "No support for BT device in ACPI firmware"); 2333 + return; 2334 + } 2335 + 2339 2336 memset(&ppag, 0, sizeof(ppag)); 2340 2337 2341 2338 ppag.hdev = hdev; 2342 - status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, 2343 - ACPI_UINT32_MAX, NULL, 2344 - btintel_ppag_callback, &ppag, NULL); 2339 + ppag.status = AE_NOT_FOUND; 2340 + acpi_walk_namespace(ACPI_TYPE_PACKAGE, handle, 1, NULL, 2341 + btintel_ppag_callback, &ppag, NULL); 2345 2342 2346 - if (ACPI_FAILURE(status)) { 2347 - /* Do not log warning message if ACPI entry is not found */ 2348 - if (status == AE_NOT_FOUND) 2343 + if (ACPI_FAILURE(ppag.status)) { 2344 + if (ppag.status == AE_NOT_FOUND) { 2345 + bt_dev_dbg(hdev, "PPAG-BT: ACPI entry not found"); 2349 2346 return; 2350 - bt_dev_warn(hdev, "PPAG: ACPI Failure: %s", acpi_format_exception(status)); 2347 + } 2351 2348 return; 2352 2349 } 2353 2350 2354 2351 if (ppag.domain != 0x12) { 2355 - bt_dev_warn(hdev, "PPAG-BT Domain disabled"); 2352 + bt_dev_warn(hdev, "PPAG-BT: domain is not bluetooth"); 2356 2353 return; 2357 2354 } 2358 2355 2359 2356 /* PPAG mode, BIT0 = 0 Disabled, BIT0 = 1 Enabled */ 2360 2357 if (!(ppag.mode & BIT(0))) { 2361 - bt_dev_dbg(hdev, "PPAG disabled"); 2358 + bt_dev_dbg(hdev, "PPAG-BT: disabled"); 2362 2359 return; 2363 2360 } 2364 2361
-7
drivers/bluetooth/btintel.h
··· 137 137 __u8 preset[8]; 138 138 } __packed; 139 139 140 - /* structure to store the PPAG data read from ACPI table */ 141 - struct btintel_ppag { 142 - u32 domain; 143 - u32 mode; 144 - struct hci_dev *hdev; 145 - }; 146 - 147 140 struct btintel_loc_aware_reg { 148 141 __le32 mcc; 149 142 __le32 sel;
+16 -1
drivers/bluetooth/btqcomsmd.c
··· 122 122 return 0; 123 123 } 124 124 125 + static int btqcomsmd_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr) 126 + { 127 + int ret; 128 + 129 + ret = qca_set_bdaddr_rome(hdev, bdaddr); 130 + if (ret) 131 + return ret; 132 + 133 + /* The firmware stops responding for a while after setting the bdaddr, 134 + * causing timeouts for subsequent commands. Sleep a bit to avoid this. 135 + */ 136 + usleep_range(1000, 10000); 137 + return 0; 138 + } 139 + 125 140 static int btqcomsmd_probe(struct platform_device *pdev) 126 141 { 127 142 struct btqcomsmd *btq; ··· 177 162 hdev->close = btqcomsmd_close; 178 163 hdev->send = btqcomsmd_send; 179 164 hdev->setup = btqcomsmd_setup; 180 - hdev->set_bdaddr = qca_set_bdaddr_rome; 165 + hdev->set_bdaddr = btqcomsmd_set_bdaddr; 181 166 182 167 ret = hci_register_dev(hdev); 183 168 if (ret < 0)
+1
drivers/bluetooth/btsdio.c
··· 354 354 355 355 BT_DBG("func %p", func); 356 356 357 + cancel_work_sync(&data->work); 357 358 if (!data) 358 359 return; 359 360
-10
drivers/bluetooth/btusb.c
··· 1050 1050 hci_skb_expect(skb) -= len; 1051 1051 1052 1052 if (skb->len == HCI_ACL_HDR_SIZE) { 1053 - __u16 handle = __le16_to_cpu(hci_acl_hdr(skb)->handle); 1054 1053 __le16 dlen = hci_acl_hdr(skb)->dlen; 1055 - __u8 type; 1056 1054 1057 1055 /* Complete ACL header */ 1058 1056 hci_skb_expect(skb) = __le16_to_cpu(dlen); 1059 - 1060 - /* Detect if ISO packet has been sent over bulk */ 1061 - if (hci_conn_num(data->hdev, ISO_LINK)) { 1062 - type = hci_conn_lookup_type(data->hdev, 1063 - hci_handle(handle)); 1064 - if (type == ISO_LINK) 1065 - hci_skb_pkt_type(skb) = HCI_ISODATA_PKT; 1066 - } 1067 1057 1068 1058 if (skb_tailroom(skb) < hci_skb_expect(skb)) { 1069 1059 kfree_skb(skb);
+1 -1
drivers/firmware/xilinx/zynqmp.c
··· 206 206 } 207 207 208 208 /* Add new entry if not present */ 209 - feature_data = kmalloc(sizeof(*feature_data), GFP_KERNEL); 209 + feature_data = kmalloc(sizeof(*feature_data), GFP_ATOMIC); 210 210 if (!feature_data) 211 211 return -ENOMEM; 212 212
+2 -3
drivers/gpu/host1x/dev.c
··· 487 487 static int host1x_probe(struct platform_device *pdev) 488 488 { 489 489 struct host1x *host; 490 - int syncpt_irq; 491 490 int err; 492 491 493 492 host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL); ··· 516 517 } 517 518 518 519 host->syncpt_irq = platform_get_irq(pdev, 0); 519 - if (syncpt_irq < 0) 520 - return syncpt_irq; 520 + if (host->syncpt_irq < 0) 521 + return host->syncpt_irq; 521 522 522 523 mutex_init(&host->devices_lock); 523 524 INIT_LIST_HEAD(&host->devices);
+4 -4
drivers/hwmon/adt7475.c
··· 488 488 val = (temp - val) / 1000; 489 489 490 490 if (sattr->index != 1) { 491 - data->temp[HYSTERSIS][sattr->index] &= 0xF0; 491 + data->temp[HYSTERSIS][sattr->index] &= 0x0F; 492 492 data->temp[HYSTERSIS][sattr->index] |= (val & 0xF) << 4; 493 493 } else { 494 - data->temp[HYSTERSIS][sattr->index] &= 0x0F; 494 + data->temp[HYSTERSIS][sattr->index] &= 0xF0; 495 495 data->temp[HYSTERSIS][sattr->index] |= (val & 0xF); 496 496 } 497 497 ··· 556 556 val = data->enh_acoustics[0] & 0xf; 557 557 break; 558 558 case 1: 559 - val = (data->enh_acoustics[1] >> 4) & 0xf; 559 + val = data->enh_acoustics[1] & 0xf; 560 560 break; 561 561 case 2: 562 562 default: 563 - val = data->enh_acoustics[1] & 0xf; 563 + val = (data->enh_acoustics[1] >> 4) & 0xf; 564 564 break; 565 565 } 566 566
+1 -1
drivers/hwmon/ina3221.c
··· 772 772 return ret; 773 773 } else if (val > INA3221_CHANNEL3) { 774 774 dev_err(dev, "invalid reg %d of %pOFn\n", val, child); 775 - return ret; 775 + return -EINVAL; 776 776 } 777 777 778 778 input = &ina->inputs[val];
+1
drivers/hwmon/ltc2992.c
··· 323 323 st->gc.label = name; 324 324 st->gc.parent = &st->client->dev; 325 325 st->gc.owner = THIS_MODULE; 326 + st->gc.can_sleep = true; 326 327 st->gc.base = -1; 327 328 st->gc.names = st->gpio_names; 328 329 st->gc.ngpio = ARRAY_SIZE(st->gpio_names);
+1
drivers/hwmon/pmbus/adm1266.c
··· 301 301 data->gc.label = name; 302 302 data->gc.parent = &data->client->dev; 303 303 data->gc.owner = THIS_MODULE; 304 + data->gc.can_sleep = true; 304 305 data->gc.base = -1; 305 306 data->gc.names = data->gpio_names; 306 307 data->gc.ngpio = ARRAY_SIZE(data->gpio_names);
+75
drivers/hwmon/pmbus/ucd9000.c
··· 7 7 */ 8 8 9 9 #include <linux/debugfs.h> 10 + #include <linux/delay.h> 10 11 #include <linux/kernel.h> 11 12 #include <linux/module.h> 12 13 #include <linux/of_device.h> ··· 17 16 #include <linux/i2c.h> 18 17 #include <linux/pmbus.h> 19 18 #include <linux/gpio/driver.h> 19 + #include <linux/timekeeping.h> 20 20 #include "pmbus.h" 21 21 22 22 enum chips { ucd9000, ucd90120, ucd90124, ucd90160, ucd90320, ucd9090, ··· 67 65 struct gpio_chip gpio; 68 66 #endif 69 67 struct dentry *debugfs; 68 + ktime_t write_time; 70 69 }; 71 70 #define to_ucd9000_data(_info) container_of(_info, struct ucd9000_data, info) 72 71 ··· 75 72 struct i2c_client *client; 76 73 u8 index; 77 74 }; 75 + 76 + /* 77 + * It has been observed that the UCD90320 randomly fails register access when 78 + * doing another access right on the back of a register write. To mitigate this 79 + * make sure that there is a minimum delay between a write access and the 80 + * following access. The 250us is based on experimental data. At a delay of 81 + * 200us the issue seems to go away. Add a bit of extra margin to allow for 82 + * system to system differences. 83 + */ 84 + #define UCD90320_WAIT_DELAY_US 250 85 + 86 + static inline void ucd90320_wait(const struct ucd9000_data *data) 87 + { 88 + s64 delta = ktime_us_delta(ktime_get(), data->write_time); 89 + 90 + if (delta < UCD90320_WAIT_DELAY_US) 91 + udelay(UCD90320_WAIT_DELAY_US - delta); 92 + } 93 + 94 + static int ucd90320_read_word_data(struct i2c_client *client, int page, 95 + int phase, int reg) 96 + { 97 + const struct pmbus_driver_info *info = pmbus_get_driver_info(client); 98 + struct ucd9000_data *data = to_ucd9000_data(info); 99 + 100 + if (reg >= PMBUS_VIRT_BASE) 101 + return -ENXIO; 102 + 103 + ucd90320_wait(data); 104 + return pmbus_read_word_data(client, page, phase, reg); 105 + } 106 + 107 + static int ucd90320_read_byte_data(struct i2c_client *client, int page, int reg) 108 + { 109 + const struct pmbus_driver_info *info = pmbus_get_driver_info(client); 110 + struct ucd9000_data *data = to_ucd9000_data(info); 111 + 112 + ucd90320_wait(data); 113 + return pmbus_read_byte_data(client, page, reg); 114 + } 115 + 116 + static int ucd90320_write_word_data(struct i2c_client *client, int page, 117 + int reg, u16 word) 118 + { 119 + const struct pmbus_driver_info *info = pmbus_get_driver_info(client); 120 + struct ucd9000_data *data = to_ucd9000_data(info); 121 + int ret; 122 + 123 + ucd90320_wait(data); 124 + ret = pmbus_write_word_data(client, page, reg, word); 125 + data->write_time = ktime_get(); 126 + 127 + return ret; 128 + } 129 + 130 + static int ucd90320_write_byte(struct i2c_client *client, int page, u8 value) 131 + { 132 + const struct pmbus_driver_info *info = pmbus_get_driver_info(client); 133 + struct ucd9000_data *data = to_ucd9000_data(info); 134 + int ret; 135 + 136 + ucd90320_wait(data); 137 + ret = pmbus_write_byte(client, page, value); 138 + data->write_time = ktime_get(); 139 + 140 + return ret; 141 + } 78 142 79 143 static int ucd9000_get_fan_config(struct i2c_client *client, int fan) 80 144 { ··· 668 598 info->read_byte_data = ucd9000_read_byte_data; 669 599 info->func[0] |= PMBUS_HAVE_FAN12 | PMBUS_HAVE_STATUS_FAN12 670 600 | PMBUS_HAVE_FAN34 | PMBUS_HAVE_STATUS_FAN34; 601 + } else if (mid->driver_data == ucd90320) { 602 + info->read_byte_data = ucd90320_read_byte_data; 603 + info->read_word_data = ucd90320_read_word_data; 604 + info->write_byte = ucd90320_write_byte; 605 + info->write_word_data = ucd90320_write_word_data; 671 606 } 672 607 673 608 ucd9000_probe_gpio(client, mid, data);
+1 -1
drivers/hwmon/tmp513.c
··· 758 758 static struct i2c_driver tmp51x_driver = { 759 759 .driver = { 760 760 .name = "tmp51x", 761 - .of_match_table = of_match_ptr(tmp51x_of_match), 761 + .of_match_table = tmp51x_of_match, 762 762 }, 763 763 .probe_new = tmp51x_probe, 764 764 .id_table = tmp51x_id,
+1
drivers/hwmon/xgene-hwmon.c
··· 761 761 { 762 762 struct xgene_hwmon_dev *ctx = platform_get_drvdata(pdev); 763 763 764 + cancel_work_sync(&ctx->workq); 764 765 hwmon_device_unregister(ctx->hwmon_dev); 765 766 kfifo_free(&ctx->async_msg_fifo); 766 767 if (acpi_disabled)
+43 -25
drivers/interconnect/core.c
··· 850 850 851 851 mutex_unlock(&icc_lock); 852 852 853 + if (!node) 854 + return; 855 + 856 + kfree(node->links); 853 857 kfree(node); 854 858 } 855 859 EXPORT_SYMBOL_GPL(icc_node_destroy); ··· 1033 1029 EXPORT_SYMBOL_GPL(icc_nodes_remove); 1034 1030 1035 1031 /** 1036 - * icc_provider_add() - add a new interconnect provider 1037 - * @provider: the interconnect provider that will be added into topology 1032 + * icc_provider_init() - initialize a new interconnect provider 1033 + * @provider: the interconnect provider to initialize 1034 + * 1035 + * Must be called before adding nodes to the provider. 1036 + */ 1037 + void icc_provider_init(struct icc_provider *provider) 1038 + { 1039 + WARN_ON(!provider->set); 1040 + 1041 + INIT_LIST_HEAD(&provider->nodes); 1042 + } 1043 + EXPORT_SYMBOL_GPL(icc_provider_init); 1044 + 1045 + /** 1046 + * icc_provider_register() - register a new interconnect provider 1047 + * @provider: the interconnect provider to register 1038 1048 * 1039 1049 * Return: 0 on success, or an error code otherwise 1040 1050 */ 1041 - int icc_provider_add(struct icc_provider *provider) 1051 + int icc_provider_register(struct icc_provider *provider) 1042 1052 { 1043 - if (WARN_ON(!provider->set)) 1044 - return -EINVAL; 1045 1053 if (WARN_ON(!provider->xlate && !provider->xlate_extended)) 1046 1054 return -EINVAL; 1047 1055 1048 1056 mutex_lock(&icc_lock); 1049 - 1050 - INIT_LIST_HEAD(&provider->nodes); 1051 1057 list_add_tail(&provider->provider_list, &icc_providers); 1052 - 1053 1058 mutex_unlock(&icc_lock); 1054 1059 1055 - dev_dbg(provider->dev, "interconnect provider added to topology\n"); 1060 + dev_dbg(provider->dev, "interconnect provider registered\n"); 1056 1061 1057 1062 return 0; 1058 1063 } 1059 - EXPORT_SYMBOL_GPL(icc_provider_add); 1064 + EXPORT_SYMBOL_GPL(icc_provider_register); 1060 1065 1061 1066 /** 1062 - * icc_provider_del() - delete previously added interconnect provider 1063 - * @provider: the interconnect provider that will be removed from topology 1067 + * icc_provider_deregister() - deregister an interconnect provider 1068 + * @provider: the interconnect provider to deregister 1064 1069 */ 1065 - void icc_provider_del(struct icc_provider *provider) 1070 + void icc_provider_deregister(struct icc_provider *provider) 1066 1071 { 1067 1072 mutex_lock(&icc_lock); 1068 - if (provider->users) { 1069 - pr_warn("interconnect provider still has %d users\n", 1070 - provider->users); 1071 - mutex_unlock(&icc_lock); 1072 - return; 1073 - } 1074 - 1075 - if (!list_empty(&provider->nodes)) { 1076 - pr_warn("interconnect provider still has nodes\n"); 1077 - mutex_unlock(&icc_lock); 1078 - return; 1079 - } 1073 + WARN_ON(provider->users); 1080 1074 1081 1075 list_del(&provider->provider_list); 1082 1076 mutex_unlock(&icc_lock); 1077 + } 1078 + EXPORT_SYMBOL_GPL(icc_provider_deregister); 1079 + 1080 + int icc_provider_add(struct icc_provider *provider) 1081 + { 1082 + icc_provider_init(provider); 1083 + 1084 + return icc_provider_register(provider); 1085 + } 1086 + EXPORT_SYMBOL_GPL(icc_provider_add); 1087 + 1088 + void icc_provider_del(struct icc_provider *provider) 1089 + { 1090 + WARN_ON(!list_empty(&provider->nodes)); 1091 + 1092 + icc_provider_deregister(provider); 1083 1093 } 1084 1094 EXPORT_SYMBOL_GPL(icc_provider_del); 1085 1095
+11 -11
drivers/interconnect/imx/imx.c
··· 295 295 provider->xlate = of_icc_xlate_onecell; 296 296 provider->data = data; 297 297 provider->dev = dev->parent; 298 + 299 + icc_provider_init(provider); 300 + 298 301 platform_set_drvdata(pdev, imx_provider); 299 302 300 303 if (settings) { ··· 309 306 } 310 307 } 311 308 312 - ret = icc_provider_add(provider); 313 - if (ret) { 314 - dev_err(dev, "error adding interconnect provider: %d\n", ret); 315 - return ret; 316 - } 317 - 318 309 ret = imx_icc_register_nodes(imx_provider, nodes, nodes_count, settings); 319 310 if (ret) 320 - goto provider_del; 311 + return ret; 312 + 313 + ret = icc_provider_register(provider); 314 + if (ret) 315 + goto err_unregister_nodes; 321 316 322 317 return 0; 323 318 324 - provider_del: 325 - icc_provider_del(provider); 319 + err_unregister_nodes: 320 + imx_icc_unregister_nodes(&imx_provider->provider); 326 321 return ret; 327 322 } 328 323 EXPORT_SYMBOL_GPL(imx_icc_register); ··· 329 328 { 330 329 struct imx_icc_provider *imx_provider = platform_get_drvdata(pdev); 331 330 331 + icc_provider_deregister(&imx_provider->provider); 332 332 imx_icc_unregister_nodes(&imx_provider->provider); 333 - 334 - icc_provider_del(&imx_provider->provider); 335 333 } 336 334 EXPORT_SYMBOL_GPL(imx_icc_unregister); 337 335
+16 -13
drivers/interconnect/qcom/icc-rpm.c
··· 503 503 } 504 504 505 505 provider = &qp->provider; 506 - INIT_LIST_HEAD(&provider->nodes); 507 506 provider->dev = dev; 508 507 provider->set = qcom_icc_set; 509 508 provider->pre_aggregate = qcom_icc_pre_bw_aggregate; ··· 510 511 provider->xlate_extended = qcom_icc_xlate_extended; 511 512 provider->data = data; 512 513 513 - ret = icc_provider_add(provider); 514 - if (ret) { 515 - dev_err(dev, "error adding interconnect provider: %d\n", ret); 516 - clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks); 517 - return ret; 518 - } 514 + icc_provider_init(provider); 519 515 520 516 for (i = 0; i < num_nodes; i++) { 521 517 size_t j; ··· 518 524 node = icc_node_create(qnodes[i]->id); 519 525 if (IS_ERR(node)) { 520 526 ret = PTR_ERR(node); 521 - goto err; 527 + goto err_remove_nodes; 522 528 } 523 529 524 530 node->name = qnodes[i]->name; ··· 532 538 } 533 539 data->num_nodes = num_nodes; 534 540 541 + ret = icc_provider_register(provider); 542 + if (ret) 543 + goto err_remove_nodes; 544 + 535 545 platform_set_drvdata(pdev, qp); 536 546 537 547 /* Populate child NoC devices if any */ 538 - if (of_get_child_count(dev->of_node) > 0) 539 - return of_platform_populate(dev->of_node, NULL, NULL, dev); 548 + if (of_get_child_count(dev->of_node) > 0) { 549 + ret = of_platform_populate(dev->of_node, NULL, NULL, dev); 550 + if (ret) 551 + goto err_deregister_provider; 552 + } 540 553 541 554 return 0; 542 - err: 555 + 556 + err_deregister_provider: 557 + icc_provider_deregister(provider); 558 + err_remove_nodes: 543 559 icc_nodes_remove(provider); 544 560 clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks); 545 - icc_provider_del(provider); 546 561 547 562 return ret; 548 563 } ··· 561 558 { 562 559 struct qcom_icc_provider *qp = platform_get_drvdata(pdev); 563 560 561 + icc_provider_deregister(&qp->provider); 564 562 icc_nodes_remove(&qp->provider); 565 563 clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks); 566 - icc_provider_del(&qp->provider); 567 564 568 565 return 0; 569 566 }
+19 -11
drivers/interconnect/qcom/icc-rpmh.c
··· 192 192 provider->pre_aggregate = qcom_icc_pre_aggregate; 193 193 provider->aggregate = qcom_icc_aggregate; 194 194 provider->xlate_extended = qcom_icc_xlate_extended; 195 - INIT_LIST_HEAD(&provider->nodes); 196 195 provider->data = data; 196 + 197 + icc_provider_init(provider); 197 198 198 199 qp->dev = dev; 199 200 qp->bcms = desc->bcms; ··· 203 202 qp->voter = of_bcm_voter_get(qp->dev, NULL); 204 203 if (IS_ERR(qp->voter)) 205 204 return PTR_ERR(qp->voter); 206 - 207 - ret = icc_provider_add(provider); 208 - if (ret) 209 - return ret; 210 205 211 206 for (i = 0; i < qp->num_bcms; i++) 212 207 qcom_icc_bcm_init(qp->bcms[i], dev); ··· 215 218 node = icc_node_create(qn->id); 216 219 if (IS_ERR(node)) { 217 220 ret = PTR_ERR(node); 218 - goto err; 221 + goto err_remove_nodes; 219 222 } 220 223 221 224 node->name = qn->name; ··· 229 232 } 230 233 231 234 data->num_nodes = num_nodes; 235 + 236 + ret = icc_provider_register(provider); 237 + if (ret) 238 + goto err_remove_nodes; 239 + 232 240 platform_set_drvdata(pdev, qp); 233 241 234 242 /* Populate child NoC devices if any */ 235 - if (of_get_child_count(dev->of_node) > 0) 236 - return of_platform_populate(dev->of_node, NULL, NULL, dev); 243 + if (of_get_child_count(dev->of_node) > 0) { 244 + ret = of_platform_populate(dev->of_node, NULL, NULL, dev); 245 + if (ret) 246 + goto err_deregister_provider; 247 + } 237 248 238 249 return 0; 239 - err: 250 + 251 + err_deregister_provider: 252 + icc_provider_deregister(provider); 253 + err_remove_nodes: 240 254 icc_nodes_remove(provider); 241 - icc_provider_del(provider); 255 + 242 256 return ret; 243 257 } 244 258 EXPORT_SYMBOL_GPL(qcom_icc_rpmh_probe); ··· 258 250 { 259 251 struct qcom_icc_provider *qp = platform_get_drvdata(pdev); 260 252 253 + icc_provider_deregister(&qp->provider); 261 254 icc_nodes_remove(&qp->provider); 262 - icc_provider_del(&qp->provider); 263 255 264 256 return 0; 265 257 }
+8 -12
drivers/interconnect/qcom/msm8974.c
··· 692 692 return ret; 693 693 694 694 provider = &qp->provider; 695 - INIT_LIST_HEAD(&provider->nodes); 696 695 provider->dev = dev; 697 696 provider->set = msm8974_icc_set; 698 697 provider->aggregate = icc_std_aggregate; ··· 699 700 provider->data = data; 700 701 provider->get_bw = msm8974_get_bw; 701 702 702 - ret = icc_provider_add(provider); 703 - if (ret) { 704 - dev_err(dev, "error adding interconnect provider: %d\n", ret); 705 - goto err_disable_clks; 706 - } 703 + icc_provider_init(provider); 707 704 708 705 for (i = 0; i < num_nodes; i++) { 709 706 size_t j; ··· 707 712 node = icc_node_create(qnodes[i]->id); 708 713 if (IS_ERR(node)) { 709 714 ret = PTR_ERR(node); 710 - goto err_del_icc; 715 + goto err_remove_nodes; 711 716 } 712 717 713 718 node->name = qnodes[i]->name; ··· 724 729 } 725 730 data->num_nodes = num_nodes; 726 731 732 + ret = icc_provider_register(provider); 733 + if (ret) 734 + goto err_remove_nodes; 735 + 727 736 platform_set_drvdata(pdev, qp); 728 737 729 738 return 0; 730 739 731 - err_del_icc: 740 + err_remove_nodes: 732 741 icc_nodes_remove(provider); 733 - icc_provider_del(provider); 734 - 735 - err_disable_clks: 736 742 clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks); 737 743 738 744 return ret; ··· 743 747 { 744 748 struct msm8974_icc_provider *qp = platform_get_drvdata(pdev); 745 749 750 + icc_provider_deregister(&qp->provider); 746 751 icc_nodes_remove(&qp->provider); 747 752 clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks); 748 - icc_provider_del(&qp->provider); 749 753 750 754 return 0; 751 755 }
+7 -9
drivers/interconnect/qcom/osm-l3.c
··· 158 158 { 159 159 struct qcom_osm_l3_icc_provider *qp = platform_get_drvdata(pdev); 160 160 161 + icc_provider_deregister(&qp->provider); 161 162 icc_nodes_remove(&qp->provider); 162 - icc_provider_del(&qp->provider); 163 163 164 164 return 0; 165 165 } ··· 236 236 qnodes = desc->nodes; 237 237 num_nodes = desc->num_nodes; 238 238 239 - data = devm_kcalloc(&pdev->dev, num_nodes, sizeof(*node), GFP_KERNEL); 239 + data = devm_kzalloc(&pdev->dev, struct_size(data, nodes, num_nodes), GFP_KERNEL); 240 240 if (!data) 241 241 return -ENOMEM; 242 242 ··· 245 245 provider->set = qcom_osm_l3_set; 246 246 provider->aggregate = icc_std_aggregate; 247 247 provider->xlate = of_icc_xlate_onecell; 248 - INIT_LIST_HEAD(&provider->nodes); 249 248 provider->data = data; 250 249 251 - ret = icc_provider_add(provider); 252 - if (ret) { 253 - dev_err(&pdev->dev, "error adding interconnect provider\n"); 254 - return ret; 255 - } 250 + icc_provider_init(provider); 256 251 257 252 for (i = 0; i < num_nodes; i++) { 258 253 size_t j; ··· 270 275 } 271 276 data->num_nodes = num_nodes; 272 277 278 + ret = icc_provider_register(provider); 279 + if (ret) 280 + goto err; 281 + 273 282 platform_set_drvdata(pdev, qp); 274 283 275 284 return 0; 276 285 err: 277 286 icc_nodes_remove(provider); 278 - icc_provider_del(provider); 279 287 280 288 return ret; 281 289 }
+2 -2
drivers/interconnect/qcom/qcm2290.c
··· 147 147 .name = "mas_snoc_bimc_nrt", 148 148 .buswidth = 16, 149 149 .qos.ap_owned = true, 150 - .qos.qos_port = 2, 150 + .qos.qos_port = 3, 151 151 .qos.qos_mode = NOC_QOS_MODE_BYPASS, 152 - .mas_rpm_id = 163, 152 + .mas_rpm_id = 164, 153 153 .slv_rpm_id = -1, 154 154 .num_links = ARRAY_SIZE(mas_snoc_bimc_nrt_links), 155 155 .links = mas_snoc_bimc_nrt_links,
+2 -96
drivers/interconnect/qcom/sm8450.c
··· 1844 1844 .num_bcms = ARRAY_SIZE(system_noc_bcms), 1845 1845 }; 1846 1846 1847 - static int qnoc_probe(struct platform_device *pdev) 1848 - { 1849 - const struct qcom_icc_desc *desc; 1850 - struct icc_onecell_data *data; 1851 - struct icc_provider *provider; 1852 - struct qcom_icc_node * const *qnodes; 1853 - struct qcom_icc_provider *qp; 1854 - struct icc_node *node; 1855 - size_t num_nodes, i; 1856 - int ret; 1857 - 1858 - desc = device_get_match_data(&pdev->dev); 1859 - if (!desc) 1860 - return -EINVAL; 1861 - 1862 - qnodes = desc->nodes; 1863 - num_nodes = desc->num_nodes; 1864 - 1865 - qp = devm_kzalloc(&pdev->dev, sizeof(*qp), GFP_KERNEL); 1866 - if (!qp) 1867 - return -ENOMEM; 1868 - 1869 - data = devm_kcalloc(&pdev->dev, num_nodes, sizeof(*node), GFP_KERNEL); 1870 - if (!data) 1871 - return -ENOMEM; 1872 - 1873 - provider = &qp->provider; 1874 - provider->dev = &pdev->dev; 1875 - provider->set = qcom_icc_set; 1876 - provider->pre_aggregate = qcom_icc_pre_aggregate; 1877 - provider->aggregate = qcom_icc_aggregate; 1878 - provider->xlate_extended = qcom_icc_xlate_extended; 1879 - INIT_LIST_HEAD(&provider->nodes); 1880 - provider->data = data; 1881 - 1882 - qp->dev = &pdev->dev; 1883 - qp->bcms = desc->bcms; 1884 - qp->num_bcms = desc->num_bcms; 1885 - 1886 - qp->voter = of_bcm_voter_get(qp->dev, NULL); 1887 - if (IS_ERR(qp->voter)) 1888 - return PTR_ERR(qp->voter); 1889 - 1890 - ret = icc_provider_add(provider); 1891 - if (ret) { 1892 - dev_err(&pdev->dev, "error adding interconnect provider\n"); 1893 - return ret; 1894 - } 1895 - 1896 - for (i = 0; i < qp->num_bcms; i++) 1897 - qcom_icc_bcm_init(qp->bcms[i], &pdev->dev); 1898 - 1899 - for (i = 0; i < num_nodes; i++) { 1900 - size_t j; 1901 - 1902 - if (!qnodes[i]) 1903 - continue; 1904 - 1905 - node = icc_node_create(qnodes[i]->id); 1906 - if (IS_ERR(node)) { 1907 - ret = PTR_ERR(node); 1908 - goto err; 1909 - } 1910 - 1911 - node->name = qnodes[i]->name; 1912 - node->data = qnodes[i]; 1913 - icc_node_add(node, provider); 1914 - 1915 - for (j = 0; j < qnodes[i]->num_links; j++) 1916 - icc_link_create(node, qnodes[i]->links[j]); 1917 - 1918 - data->nodes[i] = node; 1919 - } 1920 - data->num_nodes = num_nodes; 1921 - 1922 - platform_set_drvdata(pdev, qp); 1923 - 1924 - return 0; 1925 - err: 1926 - icc_nodes_remove(provider); 1927 - icc_provider_del(provider); 1928 - return ret; 1929 - } 1930 - 1931 - static int qnoc_remove(struct platform_device *pdev) 1932 - { 1933 - struct qcom_icc_provider *qp = platform_get_drvdata(pdev); 1934 - 1935 - icc_nodes_remove(&qp->provider); 1936 - icc_provider_del(&qp->provider); 1937 - 1938 - return 0; 1939 - } 1940 - 1941 1847 static const struct of_device_id qnoc_of_match[] = { 1942 1848 { .compatible = "qcom,sm8450-aggre1-noc", 1943 1849 .data = &sm8450_aggre1_noc}, ··· 1872 1966 MODULE_DEVICE_TABLE(of, qnoc_of_match); 1873 1967 1874 1968 static struct platform_driver qnoc_driver = { 1875 - .probe = qnoc_probe, 1876 - .remove = qnoc_remove, 1969 + .probe = qcom_icc_rpmh_probe, 1970 + .remove = qcom_icc_rpmh_remove, 1877 1971 .driver = { 1878 1972 .name = "qnoc-sm8450", 1879 1973 .of_match_table = qnoc_of_match,
+2 -97
drivers/interconnect/qcom/sm8550.c
··· 2165 2165 .num_bcms = ARRAY_SIZE(system_noc_bcms), 2166 2166 }; 2167 2167 2168 - static int qnoc_probe(struct platform_device *pdev) 2169 - { 2170 - const struct qcom_icc_desc *desc; 2171 - struct icc_onecell_data *data; 2172 - struct icc_provider *provider; 2173 - struct qcom_icc_node * const *qnodes; 2174 - struct qcom_icc_provider *qp; 2175 - struct icc_node *node; 2176 - size_t num_nodes, i; 2177 - int ret; 2178 - 2179 - desc = device_get_match_data(&pdev->dev); 2180 - if (!desc) 2181 - return -EINVAL; 2182 - 2183 - qnodes = desc->nodes; 2184 - num_nodes = desc->num_nodes; 2185 - 2186 - qp = devm_kzalloc(&pdev->dev, sizeof(*qp), GFP_KERNEL); 2187 - if (!qp) 2188 - return -ENOMEM; 2189 - 2190 - data = devm_kcalloc(&pdev->dev, num_nodes, sizeof(*node), GFP_KERNEL); 2191 - if (!data) 2192 - return -ENOMEM; 2193 - 2194 - provider = &qp->provider; 2195 - provider->dev = &pdev->dev; 2196 - provider->set = qcom_icc_set; 2197 - provider->pre_aggregate = qcom_icc_pre_aggregate; 2198 - provider->aggregate = qcom_icc_aggregate; 2199 - provider->xlate_extended = qcom_icc_xlate_extended; 2200 - INIT_LIST_HEAD(&provider->nodes); 2201 - provider->data = data; 2202 - 2203 - qp->dev = &pdev->dev; 2204 - qp->bcms = desc->bcms; 2205 - qp->num_bcms = desc->num_bcms; 2206 - 2207 - qp->voter = of_bcm_voter_get(qp->dev, NULL); 2208 - if (IS_ERR(qp->voter)) 2209 - return PTR_ERR(qp->voter); 2210 - 2211 - ret = icc_provider_add(provider); 2212 - if (ret) { 2213 - dev_err_probe(&pdev->dev, ret, 2214 - "error adding interconnect provider\n"); 2215 - return ret; 2216 - } 2217 - 2218 - for (i = 0; i < qp->num_bcms; i++) 2219 - qcom_icc_bcm_init(qp->bcms[i], &pdev->dev); 2220 - 2221 - for (i = 0; i < num_nodes; i++) { 2222 - size_t j; 2223 - 2224 - if (!qnodes[i]) 2225 - continue; 2226 - 2227 - node = icc_node_create(qnodes[i]->id); 2228 - if (IS_ERR(node)) { 2229 - ret = PTR_ERR(node); 2230 - goto err; 2231 - } 2232 - 2233 - node->name = qnodes[i]->name; 2234 - node->data = qnodes[i]; 2235 - icc_node_add(node, provider); 2236 - 2237 - for (j = 0; j < qnodes[i]->num_links; j++) 2238 - icc_link_create(node, qnodes[i]->links[j]); 2239 - 2240 - data->nodes[i] = node; 2241 - } 2242 - data->num_nodes = num_nodes; 2243 - 2244 - platform_set_drvdata(pdev, qp); 2245 - 2246 - return 0; 2247 - err: 2248 - icc_nodes_remove(provider); 2249 - icc_provider_del(provider); 2250 - return ret; 2251 - } 2252 - 2253 - static int qnoc_remove(struct platform_device *pdev) 2254 - { 2255 - struct qcom_icc_provider *qp = platform_get_drvdata(pdev); 2256 - 2257 - icc_nodes_remove(&qp->provider); 2258 - icc_provider_del(&qp->provider); 2259 - 2260 - return 0; 2261 - } 2262 - 2263 2168 static const struct of_device_id qnoc_of_match[] = { 2264 2169 { .compatible = "qcom,sm8550-aggre1-noc", 2265 2170 .data = &sm8550_aggre1_noc}, ··· 2199 2294 MODULE_DEVICE_TABLE(of, qnoc_of_match); 2200 2295 2201 2296 static struct platform_driver qnoc_driver = { 2202 - .probe = qnoc_probe, 2203 - .remove = qnoc_remove, 2297 + .probe = qcom_icc_rpmh_probe, 2298 + .remove = qcom_icc_rpmh_remove, 2204 2299 .driver = { 2205 2300 .name = "qnoc-sm8550", 2206 2301 .of_match_table = qnoc_of_match,
+12 -18
drivers/interconnect/samsung/exynos.c
··· 96 96 static int exynos_generic_icc_remove(struct platform_device *pdev) 97 97 { 98 98 struct exynos_icc_priv *priv = platform_get_drvdata(pdev); 99 - struct icc_node *parent_node, *node = priv->node; 100 99 101 - parent_node = exynos_icc_get_parent(priv->dev->parent->of_node); 102 - if (parent_node && !IS_ERR(parent_node)) 103 - icc_link_destroy(node, parent_node); 104 - 100 + icc_provider_deregister(&priv->provider); 105 101 icc_nodes_remove(&priv->provider); 106 - icc_provider_del(&priv->provider); 107 102 108 103 return 0; 109 104 } ··· 127 132 provider->inter_set = true; 128 133 provider->data = priv; 129 134 130 - ret = icc_provider_add(provider); 131 - if (ret < 0) 132 - return ret; 135 + icc_provider_init(provider); 133 136 134 137 icc_node = icc_node_create(pdev->id); 135 - if (IS_ERR(icc_node)) { 136 - ret = PTR_ERR(icc_node); 137 - goto err_prov_del; 138 - } 138 + if (IS_ERR(icc_node)) 139 + return PTR_ERR(icc_node); 139 140 140 141 priv->node = icc_node; 141 142 icc_node->name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%pOFn", ··· 140 149 &priv->bus_clk_ratio)) 141 150 priv->bus_clk_ratio = EXYNOS_ICC_DEFAULT_BUS_CLK_RATIO; 142 151 152 + icc_node->data = priv; 153 + icc_node_add(icc_node, provider); 154 + 143 155 /* 144 156 * Register a PM QoS request for the parent (devfreq) device. 145 157 */ ··· 150 156 DEV_PM_QOS_MIN_FREQUENCY, 0); 151 157 if (ret < 0) 152 158 goto err_node_del; 153 - 154 - icc_node->data = priv; 155 - icc_node_add(icc_node, provider); 156 159 157 160 icc_parent_node = exynos_icc_get_parent(bus_dev->of_node); 158 161 if (IS_ERR(icc_parent_node)) { ··· 162 171 goto err_pmqos_del; 163 172 } 164 173 174 + ret = icc_provider_register(provider); 175 + if (ret < 0) 176 + goto err_pmqos_del; 177 + 165 178 return 0; 166 179 167 180 err_pmqos_del: 168 181 dev_pm_qos_remove_request(&priv->qos_req); 169 182 err_node_del: 170 183 icc_nodes_remove(provider); 171 - err_prov_del: 172 - icc_provider_del(provider); 184 + 173 185 return ret; 174 186 } 175 187
+1 -1
drivers/media/i2c/m5mols/m5mols_core.c
··· 488 488 do { 489 489 if (code == m5mols_default_ffmt[type].code) 490 490 return type; 491 - } while (type++ != SIZE_DEFAULT_FFMT); 491 + } while (++type != SIZE_DEFAULT_FFMT); 492 492 493 493 return 0; 494 494 }
+7 -9
drivers/memory/tegra/mc.c
··· 794 794 mc->provider.aggregate = mc->soc->icc_ops->aggregate; 795 795 mc->provider.xlate_extended = mc->soc->icc_ops->xlate_extended; 796 796 797 - err = icc_provider_add(&mc->provider); 798 - if (err) 799 - return err; 797 + icc_provider_init(&mc->provider); 800 798 801 799 /* create Memory Controller node */ 802 800 node = icc_node_create(TEGRA_ICC_MC); 803 - if (IS_ERR(node)) { 804 - err = PTR_ERR(node); 805 - goto del_provider; 806 - } 801 + if (IS_ERR(node)) 802 + return PTR_ERR(node); 807 803 808 804 node->name = "Memory Controller"; 809 805 icc_node_add(node, &mc->provider); ··· 826 830 goto remove_nodes; 827 831 } 828 832 833 + err = icc_provider_register(&mc->provider); 834 + if (err) 835 + goto remove_nodes; 836 + 829 837 return 0; 830 838 831 839 remove_nodes: 832 840 icc_nodes_remove(&mc->provider); 833 - del_provider: 834 - icc_provider_del(&mc->provider); 835 841 836 842 return err; 837 843 }
+6 -6
drivers/memory/tegra/tegra124-emc.c
··· 1351 1351 emc->provider.aggregate = soc->icc_ops->aggregate; 1352 1352 emc->provider.xlate_extended = emc_of_icc_xlate_extended; 1353 1353 1354 - err = icc_provider_add(&emc->provider); 1355 - if (err) 1356 - goto err_msg; 1354 + icc_provider_init(&emc->provider); 1357 1355 1358 1356 /* create External Memory Controller node */ 1359 1357 node = icc_node_create(TEGRA_ICC_EMC); 1360 1358 if (IS_ERR(node)) { 1361 1359 err = PTR_ERR(node); 1362 - goto del_provider; 1360 + goto err_msg; 1363 1361 } 1364 1362 1365 1363 node->name = "External Memory Controller"; ··· 1378 1380 node->name = "External Memory (DRAM)"; 1379 1381 icc_node_add(node, &emc->provider); 1380 1382 1383 + err = icc_provider_register(&emc->provider); 1384 + if (err) 1385 + goto remove_nodes; 1386 + 1381 1387 return 0; 1382 1388 1383 1389 remove_nodes: 1384 1390 icc_nodes_remove(&emc->provider); 1385 - del_provider: 1386 - icc_provider_del(&emc->provider); 1387 1391 err_msg: 1388 1392 dev_err(emc->dev, "failed to initialize ICC: %d\n", err); 1389 1393
+6 -6
drivers/memory/tegra/tegra20-emc.c
··· 1021 1021 emc->provider.aggregate = soc->icc_ops->aggregate; 1022 1022 emc->provider.xlate_extended = emc_of_icc_xlate_extended; 1023 1023 1024 - err = icc_provider_add(&emc->provider); 1025 - if (err) 1026 - goto err_msg; 1024 + icc_provider_init(&emc->provider); 1027 1025 1028 1026 /* create External Memory Controller node */ 1029 1027 node = icc_node_create(TEGRA_ICC_EMC); 1030 1028 if (IS_ERR(node)) { 1031 1029 err = PTR_ERR(node); 1032 - goto del_provider; 1030 + goto err_msg; 1033 1031 } 1034 1032 1035 1033 node->name = "External Memory Controller"; ··· 1048 1050 node->name = "External Memory (DRAM)"; 1049 1051 icc_node_add(node, &emc->provider); 1050 1052 1053 + err = icc_provider_register(&emc->provider); 1054 + if (err) 1055 + goto remove_nodes; 1056 + 1051 1057 return 0; 1052 1058 1053 1059 remove_nodes: 1054 1060 icc_nodes_remove(&emc->provider); 1055 - del_provider: 1056 - icc_provider_del(&emc->provider); 1057 1061 err_msg: 1058 1062 dev_err(emc->dev, "failed to initialize ICC: %d\n", err); 1059 1063
+6 -6
drivers/memory/tegra/tegra30-emc.c
··· 1533 1533 emc->provider.aggregate = soc->icc_ops->aggregate; 1534 1534 emc->provider.xlate_extended = emc_of_icc_xlate_extended; 1535 1535 1536 - err = icc_provider_add(&emc->provider); 1537 - if (err) 1538 - goto err_msg; 1536 + icc_provider_init(&emc->provider); 1539 1537 1540 1538 /* create External Memory Controller node */ 1541 1539 node = icc_node_create(TEGRA_ICC_EMC); 1542 1540 if (IS_ERR(node)) { 1543 1541 err = PTR_ERR(node); 1544 - goto del_provider; 1542 + goto err_msg; 1545 1543 } 1546 1544 1547 1545 node->name = "External Memory Controller"; ··· 1560 1562 node->name = "External Memory (DRAM)"; 1561 1563 icc_node_add(node, &emc->provider); 1562 1564 1565 + err = icc_provider_register(&emc->provider); 1566 + if (err) 1567 + goto remove_nodes; 1568 + 1563 1569 return 0; 1564 1570 1565 1571 remove_nodes: 1566 1572 icc_nodes_remove(&emc->provider); 1567 - del_provider: 1568 - icc_provider_del(&emc->provider); 1569 1573 err_msg: 1570 1574 dev_err(emc->dev, "failed to initialize ICC: %d\n", err); 1571 1575
+1 -1
drivers/net/dsa/b53/b53_mmap.c
··· 263 263 if (of_property_read_u32(of_port, "reg", &reg)) 264 264 continue; 265 265 266 - if (reg < B53_CPU_PORT) 266 + if (reg < B53_N_PORTS) 267 267 pdata->enabled_ports |= BIT(reg); 268 268 } 269 269
+27 -22
drivers/net/dsa/mt7530.c
··· 397 397 /* Set up switch core clock for MT7530 */ 398 398 static void mt7530_pll_setup(struct mt7530_priv *priv) 399 399 { 400 + /* Disable core clock */ 401 + core_clear(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN); 402 + 400 403 /* Disable PLL */ 401 404 core_write(priv, CORE_GSWPLL_GRP1, 0); 402 405 ··· 413 410 RG_GSWPLL_EN_PRE | 414 411 RG_GSWPLL_POSDIV_200M(2) | 415 412 RG_GSWPLL_FBKDIV_200M(32)); 413 + 414 + udelay(20); 415 + 416 + /* Enable core clock */ 417 + core_set(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN); 416 418 } 417 419 418 - /* Setup TX circuit including relevant PAD and driving */ 420 + /* Setup port 6 interface mode and TRGMII TX circuit */ 419 421 static int 420 422 mt7530_pad_clk_setup(struct dsa_switch *ds, phy_interface_t interface) 421 423 { 422 424 struct mt7530_priv *priv = ds->priv; 423 - u32 ncpo1, ssc_delta, trgint, i, xtal; 425 + u32 ncpo1, ssc_delta, trgint, xtal; 424 426 425 427 xtal = mt7530_read(priv, MT7530_MHWTRAP) & HWTRAP_XTAL_MASK; 426 428 ··· 442 434 break; 443 435 case PHY_INTERFACE_MODE_TRGMII: 444 436 trgint = 1; 437 + if (xtal == HWTRAP_XTAL_25MHZ) 438 + ssc_delta = 0x57; 439 + else 440 + ssc_delta = 0x87; 445 441 if (priv->id == ID_MT7621) { 446 442 /* PLL frequency: 150MHz: 1.2GBit */ 447 443 if (xtal == HWTRAP_XTAL_40MHZ) ··· 465 453 return -EINVAL; 466 454 } 467 455 468 - if (xtal == HWTRAP_XTAL_25MHZ) 469 - ssc_delta = 0x57; 470 - else 471 - ssc_delta = 0x87; 472 - 473 456 mt7530_rmw(priv, MT7530_P6ECR, P6_INTF_MODE_MASK, 474 457 P6_INTF_MODE(trgint)); 475 458 476 459 if (trgint) { 477 - /* Lower Tx Driving for TRGMII path */ 478 - for (i = 0 ; i < NUM_TRGMII_CTRL ; i++) 479 - mt7530_write(priv, MT7530_TRGMII_TD_ODT(i), 480 - TD_DM_DRVP(8) | TD_DM_DRVN(8)); 481 - 482 - /* Disable MT7530 core and TRGMII Tx clocks */ 483 - core_clear(priv, CORE_TRGMII_GSW_CLK_CG, 484 - REG_GSWCK_EN | REG_TRGMIICK_EN); 460 + /* Disable the MT7530 TRGMII clocks */ 461 + core_clear(priv, CORE_TRGMII_GSW_CLK_CG, REG_TRGMIICK_EN); 485 462 486 463 /* Setup the MT7530 TRGMII Tx Clock */ 487 464 core_write(priv, CORE_PLL_GROUP5, RG_LCDDS_PCW_NCPO1(ncpo1)); ··· 487 486 RG_LCDDS_PCW_NCPO_CHG | RG_LCCDS_C(3) | 488 487 RG_LCDDS_PWDB | RG_LCDDS_ISO_EN); 489 488 490 - /* Enable MT7530 core and TRGMII Tx clocks */ 491 - core_set(priv, CORE_TRGMII_GSW_CLK_CG, 492 - REG_GSWCK_EN | REG_TRGMIICK_EN); 493 - } else { 494 - for (i = 0 ; i < NUM_TRGMII_CTRL; i++) 495 - mt7530_rmw(priv, MT7530_TRGMII_RD(i), 496 - RD_TAP_MASK, RD_TAP(16)); 489 + /* Enable the MT7530 TRGMII clocks */ 490 + core_set(priv, CORE_TRGMII_GSW_CLK_CG, REG_TRGMIICK_EN); 497 491 } 498 492 499 493 return 0; ··· 2197 2201 SYS_CTRL_REG_RST); 2198 2202 2199 2203 mt7530_pll_setup(priv); 2204 + 2205 + /* Lower Tx driving for TRGMII path */ 2206 + for (i = 0; i < NUM_TRGMII_CTRL; i++) 2207 + mt7530_write(priv, MT7530_TRGMII_TD_ODT(i), 2208 + TD_DM_DRVP(8) | TD_DM_DRVN(8)); 2209 + 2210 + for (i = 0; i < NUM_TRGMII_CTRL; i++) 2211 + mt7530_rmw(priv, MT7530_TRGMII_RD(i), 2212 + RD_TAP_MASK, RD_TAP(16)); 2200 2213 2201 2214 /* Enable port 6 */ 2202 2215 val = mt7530_read(priv, MT7530_MHWTRAP);
+5 -6
drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
··· 370 370 }; 371 371 372 372 static void enetc_rmon_stats(struct enetc_hw *hw, int mac, 373 - struct ethtool_rmon_stats *s, 374 - const struct ethtool_rmon_hist_range **ranges) 373 + struct ethtool_rmon_stats *s) 375 374 { 376 375 s->undersize_pkts = enetc_port_rd(hw, ENETC_PM_RUND(mac)); 377 376 s->oversize_pkts = enetc_port_rd(hw, ENETC_PM_ROVR(mac)); ··· 392 393 s->hist_tx[4] = enetc_port_rd(hw, ENETC_PM_T1023(mac)); 393 394 s->hist_tx[5] = enetc_port_rd(hw, ENETC_PM_T1522(mac)); 394 395 s->hist_tx[6] = enetc_port_rd(hw, ENETC_PM_T1523X(mac)); 395 - 396 - *ranges = enetc_rmon_ranges; 397 396 } 398 397 399 398 static void enetc_get_eth_mac_stats(struct net_device *ndev, ··· 444 447 struct enetc_hw *hw = &priv->si->hw; 445 448 struct enetc_si *si = priv->si; 446 449 450 + *ranges = enetc_rmon_ranges; 451 + 447 452 switch (rmon_stats->src) { 448 453 case ETHTOOL_MAC_STATS_SRC_EMAC: 449 - enetc_rmon_stats(hw, 0, rmon_stats, ranges); 454 + enetc_rmon_stats(hw, 0, rmon_stats); 450 455 break; 451 456 case ETHTOOL_MAC_STATS_SRC_PMAC: 452 457 if (si->hw_features & ENETC_SI_F_QBU) 453 - enetc_rmon_stats(hw, 1, rmon_stats, ranges); 458 + enetc_rmon_stats(hw, 1, rmon_stats); 454 459 break; 455 460 case ETHTOOL_MAC_STATS_SRC_AGGREGATE: 456 461 ethtool_aggregate_rmon_stats(ndev, rmon_stats);
+4 -1
drivers/net/ethernet/google/gve/gve_ethtool.c
··· 584 584 struct ethtool_link_ksettings *cmd) 585 585 { 586 586 struct gve_priv *priv = netdev_priv(netdev); 587 - int err = gve_adminq_report_link_speed(priv); 587 + int err = 0; 588 + 589 + if (priv->link_speed == 0) 590 + err = gve_adminq_report_link_speed(priv); 588 591 589 592 cmd->base.speed = priv->link_speed; 590 593 return err;
+4 -4
drivers/net/ethernet/intel/i40e/i40e_txrx.c
··· 171 171 struct i40e_fdir_filter *data) 172 172 { 173 173 bool is_vlan = !!data->vlan_tag; 174 - struct vlan_hdr vlan; 175 - struct ipv6hdr ipv6; 176 - struct ethhdr eth; 177 - struct iphdr ip; 174 + struct vlan_hdr vlan = {}; 175 + struct ipv6hdr ipv6 = {}; 176 + struct ethhdr eth = {}; 177 + struct iphdr ip = {}; 178 178 u8 *tmp; 179 179 180 180 if (ipv4) {
+1 -1
drivers/net/ethernet/intel/iavf/iavf_common.c
··· 661 661 /* Non Tunneled IPv6 */ 662 662 IAVF_PTT(88, IP, IPV6, FRG, NONE, NONE, NOF, NONE, PAY3), 663 663 IAVF_PTT(89, IP, IPV6, NOF, NONE, NONE, NOF, NONE, PAY3), 664 - IAVF_PTT(90, IP, IPV6, NOF, NONE, NONE, NOF, UDP, PAY3), 664 + IAVF_PTT(90, IP, IPV6, NOF, NONE, NONE, NOF, UDP, PAY4), 665 665 IAVF_PTT_UNUSED_ENTRY(91), 666 666 IAVF_PTT(92, IP, IPV6, NOF, NONE, NONE, NOF, TCP, PAY4), 667 667 IAVF_PTT(93, IP, IPV6, NOF, NONE, NONE, NOF, SCTP, PAY4),
+13
drivers/net/ethernet/intel/iavf/iavf_main.c
··· 893 893 { 894 894 struct iavf_adapter *adapter = netdev_priv(netdev); 895 895 896 + /* Do not track VLAN 0 filter, always added by the PF on VF init */ 897 + if (!vid) 898 + return 0; 899 + 896 900 if (!VLAN_FILTERING_ALLOWED(adapter)) 897 901 return -EIO; 898 902 ··· 922 918 __always_unused __be16 proto, u16 vid) 923 919 { 924 920 struct iavf_adapter *adapter = netdev_priv(netdev); 921 + 922 + /* We do not track VLAN 0 filter */ 923 + if (!vid) 924 + return 0; 925 925 926 926 iavf_del_vlan(adapter, IAVF_VLAN(vid, be16_to_cpu(proto))); 927 927 if (proto == cpu_to_be16(ETH_P_8021Q)) ··· 5073 5065 adapter->state == __IAVF_INIT_FAILED) { 5074 5066 mutex_unlock(&adapter->crit_lock); 5075 5067 break; 5068 + } 5069 + /* Simply return if we already went through iavf_shutdown */ 5070 + if (adapter->state == __IAVF_REMOVE) { 5071 + mutex_unlock(&adapter->crit_lock); 5072 + return; 5076 5073 } 5077 5074 5078 5075 mutex_unlock(&adapter->crit_lock);
+1 -1
drivers/net/ethernet/intel/iavf/iavf_txrx.c
··· 1096 1096 cpu_to_le64((u64)IAVF_RX_DESC_FLTSTAT_RSS_HASH << 1097 1097 IAVF_RX_DESC_STATUS_FLTSTAT_SHIFT); 1098 1098 1099 - if (ring->netdev->features & NETIF_F_RXHASH) 1099 + if (!(ring->netdev->features & NETIF_F_RXHASH)) 1100 1100 return; 1101 1101 1102 1102 if ((rx_desc->wb.qword1.status_error_len & rss_mask) == rss_mask) {
-2
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
··· 2446 2446 list_for_each_entry(f, &adapter->vlan_filter_list, list) { 2447 2447 if (f->is_new_vlan) { 2448 2448 f->is_new_vlan = false; 2449 - if (!f->vlan.vid) 2450 - continue; 2451 2449 if (f->vlan.tpid == ETH_P_8021Q) 2452 2450 set_bit(f->vlan.vid, 2453 2451 adapter->vsi.active_cvlans);
+1 -1
drivers/net/ethernet/intel/ice/ice_lib.c
··· 291 291 struct ice_vsi_ctx *ctxt; 292 292 int status; 293 293 294 + ice_fltr_remove_all(vsi); 294 295 ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL); 295 296 if (!ctxt) 296 297 return; ··· 2893 2892 !test_bit(ICE_FLAG_FW_LLDP_AGENT, pf->flags)) 2894 2893 ice_cfg_sw_lldp(vsi, false, false); 2895 2894 2896 - ice_fltr_remove_all(vsi); 2897 2895 ice_rm_vsi_lan_cfg(vsi->port_info, vsi->idx); 2898 2896 err = ice_rm_vsi_rdma_cfg(vsi->port_info, vsi->idx); 2899 2897 if (err)
+7 -1
drivers/net/ethernet/intel/ice/ice_main.c
··· 4649 4649 return err; 4650 4650 } 4651 4651 4652 + static void ice_stop_eth(struct ice_vsi *vsi) 4653 + { 4654 + ice_fltr_remove_all(vsi); 4655 + ice_vsi_close(vsi); 4656 + } 4657 + 4652 4658 static int ice_init_eth(struct ice_pf *pf) 4653 4659 { 4654 4660 struct ice_vsi *vsi = ice_get_main_vsi(pf); ··· 5143 5137 { 5144 5138 ice_deinit_features(pf); 5145 5139 ice_deinit_rdma(pf); 5146 - ice_vsi_close(ice_get_main_vsi(pf)); 5140 + ice_stop_eth(ice_get_main_vsi(pf)); 5147 5141 ice_vsi_decfg(ice_get_main_vsi(pf)); 5148 5142 ice_deinit_dev(pf); 5149 5143 }
+4 -4
drivers/net/ethernet/intel/ice/ice_sriov.c
··· 1331 1331 struct ice_vf *vf; 1332 1332 int ret; 1333 1333 1334 + vf = ice_get_vf_by_id(pf, vf_id); 1335 + if (!vf) 1336 + return -EINVAL; 1337 + 1334 1338 if (ice_is_eswitch_mode_switchdev(pf)) { 1335 1339 dev_info(ice_pf_to_dev(pf), "Trusted VF is forbidden in switchdev mode\n"); 1336 1340 return -EOPNOTSUPP; 1337 1341 } 1338 - 1339 - vf = ice_get_vf_by_id(pf, vf_id); 1340 - if (!vf) 1341 - return -EINVAL; 1342 1342 1343 1343 ret = ice_check_vf_ready_for_cfg(vf); 1344 1344 if (ret)
+1
drivers/net/ethernet/intel/ice/ice_txrx.c
··· 1210 1210 ice_vc_fdir_irq_handler(ctrl_vsi, rx_desc); 1211 1211 if (++ntc == cnt) 1212 1212 ntc = 0; 1213 + rx_ring->first_desc = ntc; 1213 1214 continue; 1214 1215 } 1215 1216
+58 -79
drivers/net/ethernet/intel/igb/igb_main.c
··· 108 108 static void igb_setup_mrqc(struct igb_adapter *); 109 109 static int igb_probe(struct pci_dev *, const struct pci_device_id *); 110 110 static void igb_remove(struct pci_dev *pdev); 111 + static void igb_init_queue_configuration(struct igb_adapter *adapter); 111 112 static int igb_sw_init(struct igb_adapter *); 112 113 int igb_open(struct net_device *); 113 114 int igb_close(struct net_device *); ··· 175 174 176 175 #ifdef CONFIG_PCI_IOV 177 176 static int igb_vf_configure(struct igb_adapter *adapter, int vf); 178 - static int igb_pci_enable_sriov(struct pci_dev *dev, int num_vfs); 179 - static int igb_disable_sriov(struct pci_dev *dev); 180 - static int igb_pci_disable_sriov(struct pci_dev *dev); 177 + static int igb_disable_sriov(struct pci_dev *dev, bool reinit); 181 178 #endif 182 179 183 180 static int igb_suspend(struct device *); ··· 3663 3664 kfree(adapter->shadow_vfta); 3664 3665 igb_clear_interrupt_scheme(adapter); 3665 3666 #ifdef CONFIG_PCI_IOV 3666 - igb_disable_sriov(pdev); 3667 + igb_disable_sriov(pdev, false); 3667 3668 #endif 3668 3669 pci_iounmap(pdev, adapter->io_addr); 3669 3670 err_ioremap: ··· 3677 3678 } 3678 3679 3679 3680 #ifdef CONFIG_PCI_IOV 3680 - static int igb_disable_sriov(struct pci_dev *pdev) 3681 + static int igb_sriov_reinit(struct pci_dev *dev) 3682 + { 3683 + struct net_device *netdev = pci_get_drvdata(dev); 3684 + struct igb_adapter *adapter = netdev_priv(netdev); 3685 + struct pci_dev *pdev = adapter->pdev; 3686 + 3687 + rtnl_lock(); 3688 + 3689 + if (netif_running(netdev)) 3690 + igb_close(netdev); 3691 + else 3692 + igb_reset(adapter); 3693 + 3694 + igb_clear_interrupt_scheme(adapter); 3695 + 3696 + igb_init_queue_configuration(adapter); 3697 + 3698 + if (igb_init_interrupt_scheme(adapter, true)) { 3699 + rtnl_unlock(); 3700 + dev_err(&pdev->dev, "Unable to allocate memory for queues\n"); 3701 + return -ENOMEM; 3702 + } 3703 + 3704 + if (netif_running(netdev)) 3705 + igb_open(netdev); 3706 + 3707 + rtnl_unlock(); 3708 + 3709 + return 0; 3710 + } 3711 + 3712 + static int igb_disable_sriov(struct pci_dev *pdev, bool reinit) 3681 3713 { 3682 3714 struct net_device *netdev = pci_get_drvdata(pdev); 3683 3715 struct igb_adapter *adapter = netdev_priv(netdev); ··· 3742 3712 adapter->flags |= IGB_FLAG_DMAC; 3743 3713 } 3744 3714 3745 - return 0; 3715 + return reinit ? igb_sriov_reinit(pdev) : 0; 3746 3716 } 3747 3717 3748 - static int igb_enable_sriov(struct pci_dev *pdev, int num_vfs) 3718 + static int igb_enable_sriov(struct pci_dev *pdev, int num_vfs, bool reinit) 3749 3719 { 3750 3720 struct net_device *netdev = pci_get_drvdata(pdev); 3751 3721 struct igb_adapter *adapter = netdev_priv(netdev); ··· 3810 3780 "Unable to allocate memory for VF MAC filter list\n"); 3811 3781 } 3812 3782 3813 - /* only call pci_enable_sriov() if no VFs are allocated already */ 3814 - if (!old_vfs) { 3815 - err = pci_enable_sriov(pdev, adapter->vfs_allocated_count); 3816 - if (err) 3817 - goto err_out; 3818 - } 3819 3783 dev_info(&pdev->dev, "%d VFs allocated\n", 3820 3784 adapter->vfs_allocated_count); 3821 3785 for (i = 0; i < adapter->vfs_allocated_count; i++) ··· 3817 3793 3818 3794 /* DMA Coalescing is not supported in IOV mode. */ 3819 3795 adapter->flags &= ~IGB_FLAG_DMAC; 3796 + 3797 + if (reinit) { 3798 + err = igb_sriov_reinit(pdev); 3799 + if (err) 3800 + goto err_out; 3801 + } 3802 + 3803 + /* only call pci_enable_sriov() if no VFs are allocated already */ 3804 + if (!old_vfs) 3805 + err = pci_enable_sriov(pdev, adapter->vfs_allocated_count); 3806 + 3820 3807 goto out; 3821 3808 3822 3809 err_out: ··· 3897 3862 igb_release_hw_control(adapter); 3898 3863 3899 3864 #ifdef CONFIG_PCI_IOV 3900 - rtnl_lock(); 3901 - igb_disable_sriov(pdev); 3902 - rtnl_unlock(); 3865 + igb_disable_sriov(pdev, false); 3903 3866 #endif 3904 3867 3905 3868 unregister_netdev(netdev); ··· 3943 3910 igb_reset_interrupt_capability(adapter); 3944 3911 3945 3912 pci_sriov_set_totalvfs(pdev, 7); 3946 - igb_enable_sriov(pdev, max_vfs); 3913 + igb_enable_sriov(pdev, max_vfs, false); 3947 3914 3948 3915 #endif /* CONFIG_PCI_IOV */ 3949 3916 } ··· 9552 9519 } 9553 9520 } 9554 9521 9555 - #ifdef CONFIG_PCI_IOV 9556 - static int igb_sriov_reinit(struct pci_dev *dev) 9557 - { 9558 - struct net_device *netdev = pci_get_drvdata(dev); 9559 - struct igb_adapter *adapter = netdev_priv(netdev); 9560 - struct pci_dev *pdev = adapter->pdev; 9561 - 9562 - rtnl_lock(); 9563 - 9564 - if (netif_running(netdev)) 9565 - igb_close(netdev); 9566 - else 9567 - igb_reset(adapter); 9568 - 9569 - igb_clear_interrupt_scheme(adapter); 9570 - 9571 - igb_init_queue_configuration(adapter); 9572 - 9573 - if (igb_init_interrupt_scheme(adapter, true)) { 9574 - rtnl_unlock(); 9575 - dev_err(&pdev->dev, "Unable to allocate memory for queues\n"); 9576 - return -ENOMEM; 9577 - } 9578 - 9579 - if (netif_running(netdev)) 9580 - igb_open(netdev); 9581 - 9582 - rtnl_unlock(); 9583 - 9584 - return 0; 9585 - } 9586 - 9587 - static int igb_pci_disable_sriov(struct pci_dev *dev) 9588 - { 9589 - int err = igb_disable_sriov(dev); 9590 - 9591 - if (!err) 9592 - err = igb_sriov_reinit(dev); 9593 - 9594 - return err; 9595 - } 9596 - 9597 - static int igb_pci_enable_sriov(struct pci_dev *dev, int num_vfs) 9598 - { 9599 - int err = igb_enable_sriov(dev, num_vfs); 9600 - 9601 - if (err) 9602 - goto out; 9603 - 9604 - err = igb_sriov_reinit(dev); 9605 - if (!err) 9606 - return num_vfs; 9607 - 9608 - out: 9609 - return err; 9610 - } 9611 - 9612 - #endif 9613 9522 static int igb_pci_sriov_configure(struct pci_dev *dev, int num_vfs) 9614 9523 { 9615 9524 #ifdef CONFIG_PCI_IOV 9616 - if (num_vfs == 0) 9617 - return igb_pci_disable_sriov(dev); 9618 - else 9619 - return igb_pci_enable_sriov(dev, num_vfs); 9525 + int err; 9526 + 9527 + if (num_vfs == 0) { 9528 + return igb_disable_sriov(dev, true); 9529 + } else { 9530 + err = igb_enable_sriov(dev, num_vfs, true); 9531 + return err ? err : num_vfs; 9532 + } 9620 9533 #endif 9621 9534 return 0; 9622 9535 }
+6 -2
drivers/net/ethernet/intel/igbvf/netdev.c
··· 1074 1074 igbvf_intr_msix_rx, 0, adapter->rx_ring->name, 1075 1075 netdev); 1076 1076 if (err) 1077 - goto out; 1077 + goto free_irq_tx; 1078 1078 1079 1079 adapter->rx_ring->itr_register = E1000_EITR(vector); 1080 1080 adapter->rx_ring->itr_val = adapter->current_itr; ··· 1083 1083 err = request_irq(adapter->msix_entries[vector].vector, 1084 1084 igbvf_msix_other, 0, netdev->name, netdev); 1085 1085 if (err) 1086 - goto out; 1086 + goto free_irq_rx; 1087 1087 1088 1088 igbvf_configure_msix(adapter); 1089 1089 return 0; 1090 + free_irq_rx: 1091 + free_irq(adapter->msix_entries[--vector].vector, netdev); 1092 + free_irq_tx: 1093 + free_irq(adapter->msix_entries[--vector].vector, netdev); 1090 1094 out: 1091 1095 return err; 1092 1096 }
+10 -3
drivers/net/ethernet/intel/igbvf/vf.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /* Copyright(c) 2009 - 2018 Intel Corporation. */ 3 3 4 + #include <linux/etherdevice.h> 5 + 4 6 #include "vf.h" 5 7 6 8 static s32 e1000_check_for_link_vf(struct e1000_hw *hw); ··· 133 131 /* set our "perm_addr" based on info provided by PF */ 134 132 ret_val = mbx->ops.read_posted(hw, msgbuf, 3); 135 133 if (!ret_val) { 136 - if (msgbuf[0] == (E1000_VF_RESET | 137 - E1000_VT_MSGTYPE_ACK)) 134 + switch (msgbuf[0]) { 135 + case E1000_VF_RESET | E1000_VT_MSGTYPE_ACK: 138 136 memcpy(hw->mac.perm_addr, addr, ETH_ALEN); 139 - else 137 + break; 138 + case E1000_VF_RESET | E1000_VT_MSGTYPE_NACK: 139 + eth_zero_addr(hw->mac.perm_addr); 140 + break; 141 + default: 140 142 ret_val = -E1000_ERR_MAC_INIT; 143 + } 141 144 } 142 145 } 143 146
+10 -10
drivers/net/ethernet/intel/igc/igc_main.c
··· 6004 6004 if (e->command != TC_TAPRIO_CMD_SET_GATES) 6005 6005 return false; 6006 6006 6007 - for (i = 0; i < adapter->num_tx_queues; i++) { 6008 - if (e->gate_mask & BIT(i)) 6007 + for (i = 0; i < adapter->num_tx_queues; i++) 6008 + if (e->gate_mask & BIT(i)) { 6009 6009 queue_uses[i]++; 6010 6010 6011 - /* There are limitations: A single queue cannot be 6012 - * opened and closed multiple times per cycle unless the 6013 - * gate stays open. Check for it. 6014 - */ 6015 - if (queue_uses[i] > 1 && 6016 - !(prev->gate_mask & BIT(i))) 6017 - return false; 6018 - } 6011 + /* There are limitations: A single queue cannot 6012 + * be opened and closed multiple times per cycle 6013 + * unless the gate stays open. Check for it. 6014 + */ 6015 + if (queue_uses[i] > 1 && 6016 + !(prev->gate_mask & BIT(i))) 6017 + return false; 6018 + } 6019 6019 } 6020 6020 6021 6021 return true;
+2
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
··· 709 709 err_ptp_destroy: 710 710 otx2_ptp_destroy(vf); 711 711 err_detach_rsrc: 712 + free_percpu(vf->hw.lmt_info); 712 713 if (test_bit(CN10K_LMTST, &vf->hw.cap_flag)) 713 714 qmem_free(vf->dev, vf->dync_lmt); 714 715 otx2_detach_resources(&vf->mbox); ··· 763 762 otx2_shutdown_tc(vf); 764 763 otx2vf_disable_mbox_intr(vf); 765 764 otx2_detach_resources(&vf->mbox); 765 + free_percpu(vf->hw.lmt_info); 766 766 if (test_bit(CN10K_LMTST, &vf->hw.cap_flag)) 767 767 qmem_free(vf->dev, vf->dync_lmt); 768 768 otx2vf_vfaf_mbox_destroy(vf);
+2 -2
drivers/net/ethernet/mellanox/mlx4/en_rx.c
··· 674 674 struct mlx4_en_xdp_buff *_ctx = (void *)ctx; 675 675 676 676 if (unlikely(_ctx->ring->hwtstamp_rx_filter != HWTSTAMP_FILTER_ALL)) 677 - return -EOPNOTSUPP; 677 + return -ENODATA; 678 678 679 679 *timestamp = mlx4_en_get_hwtstamp(_ctx->mdev, 680 680 mlx4_en_get_cqe_ts(_ctx->cqe)); ··· 686 686 struct mlx4_en_xdp_buff *_ctx = (void *)ctx; 687 687 688 688 if (unlikely(!(_ctx->dev->features & NETIF_F_RXHASH))) 689 - return -EOPNOTSUPP; 689 + return -ENODATA; 690 690 691 691 *hash = be32_to_cpu(_ctx->cqe->immed_rss_invalid); 692 692 return 0;
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/devlink.c
··· 529 529 { 530 530 struct mlx5_core_dev *dev = devlink_priv(devlink); 531 531 union devlink_param_value value; 532 + u32 link_speed = 0; 532 533 u64 link_speed64; 533 - u32 link_speed; 534 534 535 535 /* set hairpin pair per each 50Gbs share of the link */ 536 536 mlx5_port_max_linkspeed(dev, &link_speed);
+2 -2
drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
··· 162 162 const struct mlx5e_xdp_buff *_ctx = (void *)ctx; 163 163 164 164 if (unlikely(!mlx5e_rx_hw_stamp(_ctx->rq->tstamp))) 165 - return -EOPNOTSUPP; 165 + return -ENODATA; 166 166 167 167 *timestamp = mlx5e_cqe_ts_to_ns(_ctx->rq->ptp_cyc2time, 168 168 _ctx->rq->clock, get_cqe_ts(_ctx->cqe)); ··· 174 174 const struct mlx5e_xdp_buff *_ctx = (void *)ctx; 175 175 176 176 if (unlikely(!(_ctx->xdp.rxq->dev->features & NETIF_F_RXHASH))) 177 - return -EOPNOTSUPP; 177 + return -ENODATA; 178 178 179 179 *hash = be32_to_cpu(_ctx->cqe->rss_hash_result); 180 180 return 0;
+8 -1
drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
··· 1412 1412 struct mlx5e_macsec_aso *aso; 1413 1413 struct mlx5_aso_wqe *aso_wqe; 1414 1414 struct mlx5_aso *maso; 1415 + unsigned long expires; 1415 1416 int err; 1416 1417 1417 1418 aso = &macsec->aso; ··· 1426 1425 macsec_aso_build_wqe_ctrl_seg(aso, &aso_wqe->aso_ctrl, NULL); 1427 1426 1428 1427 mlx5_aso_post_wqe(maso, false, &aso_wqe->ctrl); 1429 - err = mlx5_aso_poll_cq(maso, false); 1428 + expires = jiffies + msecs_to_jiffies(10); 1429 + do { 1430 + err = mlx5_aso_poll_cq(maso, false); 1431 + if (err) 1432 + usleep_range(2, 10); 1433 + } while (err && time_is_after_jiffies(expires)); 1434 + 1430 1435 if (err) 1431 1436 goto err_out; 1432 1437
+4 -2
drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
··· 117 117 if (!MLX5_CAP_GEN(priv->mdev, ets)) 118 118 return -EOPNOTSUPP; 119 119 120 - ets->ets_cap = mlx5_max_tc(priv->mdev) + 1; 121 - for (i = 0; i < ets->ets_cap; i++) { 120 + for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) { 122 121 err = mlx5_query_port_prio_tc(mdev, i, &ets->prio_tc[i]); 123 122 if (err) 124 123 return err; 124 + } 125 125 126 + ets->ets_cap = mlx5_max_tc(priv->mdev) + 1; 127 + for (i = 0; i < ets->ets_cap; i++) { 126 128 err = mlx5_query_port_tc_group(mdev, i, &tc_group[i]); 127 129 if (err) 128 130 return err;
+5 -1
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
··· 4150 4150 } 4151 4151 } 4152 4152 4153 - if (mlx5e_is_uplink_rep(priv)) 4153 + if (mlx5e_is_uplink_rep(priv)) { 4154 4154 features = mlx5e_fix_uplink_rep_features(netdev, features); 4155 + features |= NETIF_F_NETNS_LOCAL; 4156 + } else { 4157 + features &= ~NETIF_F_NETNS_LOCAL; 4158 + } 4155 4159 4156 4160 mutex_unlock(&priv->state_lock); 4157 4161
+1 -2
drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c
··· 364 364 365 365 if (WARN_ON_ONCE(IS_ERR(vport))) { 366 366 esw_warn(esw->dev, "vport(%d) invalid!\n", vport_num); 367 - err = PTR_ERR(vport); 368 - goto out; 367 + return PTR_ERR(vport); 369 368 } 370 369 371 370 esw_acl_ingress_ofld_rules_destroy(esw, vport);
+1
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
··· 959 959 */ 960 960 esw_vport_change_handle_locked(vport); 961 961 vport->enabled_events = 0; 962 + esw_apply_vport_rx_mode(esw, vport, false, false); 962 963 esw_vport_cleanup(esw, vport); 963 964 esw->enabled_vports--; 964 965
+19
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
··· 3403 3403 return 0; 3404 3404 } 3405 3405 3406 + static bool esw_offloads_devlink_ns_eq_netdev_ns(struct devlink *devlink) 3407 + { 3408 + struct net *devl_net, *netdev_net; 3409 + struct mlx5_eswitch *esw; 3410 + 3411 + esw = mlx5_devlink_eswitch_get(devlink); 3412 + netdev_net = dev_net(esw->dev->mlx5e_res.uplink_netdev); 3413 + devl_net = devlink_net(devlink); 3414 + 3415 + return net_eq(devl_net, netdev_net); 3416 + } 3417 + 3406 3418 int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode, 3407 3419 struct netlink_ext_ack *extack) 3408 3420 { ··· 3428 3416 3429 3417 if (esw_mode_from_devlink(mode, &mlx5_mode)) 3430 3418 return -EINVAL; 3419 + 3420 + if (mode == DEVLINK_ESWITCH_MODE_SWITCHDEV && 3421 + !esw_offloads_devlink_ns_eq_netdev_ns(devlink)) { 3422 + NL_SET_ERR_MSG_MOD(extack, 3423 + "Can't change E-Switch mode to switchdev when netdev net namespace has diverged from the devlink's."); 3424 + return -EPERM; 3425 + } 3431 3426 3432 3427 mlx5_lag_disable_change(esw->dev); 3433 3428 err = mlx5_esw_try_lock(esw);
+1 -6
drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
··· 105 105 struct thermal_zone_device *tzdev; 106 106 int polling_delay; 107 107 struct thermal_cooling_device *cdevs[MLXSW_MFCR_PWMS_MAX]; 108 - u8 cooling_levels[MLXSW_THERMAL_MAX_STATE + 1]; 109 108 struct thermal_trip trips[MLXSW_THERMAL_NUM_TRIPS]; 110 109 struct mlxsw_cooling_states cooling_states[MLXSW_THERMAL_NUM_TRIPS]; 111 110 struct mlxsw_thermal_area line_cards[]; ··· 467 468 return idx; 468 469 469 470 /* Normalize the state to the valid speed range. */ 470 - state = thermal->cooling_levels[state]; 471 + state = max_t(unsigned long, MLXSW_THERMAL_MIN_STATE, state); 471 472 mlxsw_reg_mfsc_pack(mfsc_pl, idx, mlxsw_state_to_duty(state)); 472 473 err = mlxsw_reg_write(thermal->core, MLXSW_REG(mfsc), mfsc_pl); 473 474 if (err) { ··· 857 858 thermal->cdevs[i] = cdev; 858 859 } 859 860 } 860 - 861 - /* Initialize cooling levels per PWM state. */ 862 - for (i = 0; i < MLXSW_THERMAL_MAX_STATE; i++) 863 - thermal->cooling_levels[i] = max(MLXSW_THERMAL_MIN_STATE, i); 864 861 865 862 thermal->polling_delay = bus_info->low_frequency ? 866 863 MLXSW_THERMAL_SLOW_POLL_INT :
+2 -2
drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c
··· 1354 1354 u16 vid) 1355 1355 { 1356 1356 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; 1357 - u8 local_port = mlxsw_sp_port->local_port; 1357 + u16 local_port = mlxsw_sp_port->local_port; 1358 1358 int err; 1359 1359 1360 1360 /* In case there are no {Port, VID} => FID mappings on the port, ··· 1391 1391 struct mlxsw_sp_port *mlxsw_sp_port, u16 vid) 1392 1392 { 1393 1393 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; 1394 - u8 local_port = mlxsw_sp_port->local_port; 1394 + u16 local_port = mlxsw_sp_port->local_port; 1395 1395 1396 1396 mlxsw_sp_fid_port_vid_list_del(fid, mlxsw_sp_port->local_port, vid); 1397 1397 mlxsw_sp_fid_evid_map(fid, local_port, vid, false);
+7 -4
drivers/net/ethernet/mscc/ocelot_stats.c
··· 258 258 struct ocelot_stats_region { 259 259 struct list_head node; 260 260 u32 base; 261 + enum ocelot_stat first_stat; 261 262 int count; 262 263 u32 *buf; 263 264 }; ··· 274 273 OCELOT_STAT(RX_ASSEMBLY_OK), 275 274 OCELOT_STAT(RX_MERGE_FRAGMENTS), 276 275 OCELOT_STAT(TX_MERGE_FRAGMENTS), 276 + OCELOT_STAT(TX_MM_HOLD), 277 277 OCELOT_STAT(RX_PMAC_OCTETS), 278 278 OCELOT_STAT(RX_PMAC_UNICAST), 279 279 OCELOT_STAT(RX_PMAC_MULTICAST), ··· 343 341 */ 344 342 static void ocelot_port_transfer_stats(struct ocelot *ocelot, int port) 345 343 { 346 - unsigned int idx = port * OCELOT_NUM_STATS; 347 344 struct ocelot_stats_region *region; 348 345 int j; 349 346 350 347 list_for_each_entry(region, &ocelot->stats_regions, node) { 348 + unsigned int idx = port * OCELOT_NUM_STATS + region->first_stat; 349 + 351 350 for (j = 0; j < region->count; j++) { 352 351 u64 *stat = &ocelot->stats[idx + j]; 353 352 u64 val = region->buf[j]; ··· 358 355 359 356 *stat = (*stat & ~(u64)U32_MAX) + val; 360 357 } 361 - 362 - idx += region->count; 363 358 } 364 359 } 365 360 ··· 900 899 if (!layout[i].reg) 901 900 continue; 902 901 903 - if (region && layout[i].reg == last + 4) { 902 + if (region && ocelot->map[SYS][layout[i].reg & REG_MASK] == 903 + ocelot->map[SYS][last & REG_MASK] + 4) { 904 904 region->count++; 905 905 } else { 906 906 region = devm_kzalloc(ocelot->dev, sizeof(*region), ··· 916 914 WARN_ON(last >= layout[i].reg); 917 915 918 916 region->base = layout[i].reg; 917 + region->first_stat = i; 919 918 region->count = 1; 920 919 list_add_tail(&region->node, &ocelot->stats_regions); 921 920 }
+2 -2
drivers/net/ethernet/natsemi/sonic.c
··· 292 292 */ 293 293 294 294 laddr = dma_map_single(lp->device, skb->data, length, DMA_TO_DEVICE); 295 - if (!laddr) { 295 + if (dma_mapping_error(lp->device, laddr)) { 296 296 pr_err_ratelimited("%s: failed to map tx DMA buffer.\n", dev->name); 297 297 dev_kfree_skb_any(skb); 298 298 return NETDEV_TX_OK; ··· 509 509 510 510 *new_addr = dma_map_single(lp->device, skb_put(*new_skb, SONIC_RBSIZE), 511 511 SONIC_RBSIZE, DMA_FROM_DEVICE); 512 - if (!*new_addr) { 512 + if (dma_mapping_error(lp->device, *new_addr)) { 513 513 dev_kfree_skb(*new_skb); 514 514 *new_skb = NULL; 515 515 return false;
+4 -1
drivers/net/ethernet/qlogic/qed/qed_sriov.c
··· 4404 4404 } 4405 4405 4406 4406 vf = qed_iov_get_vf_info(QED_LEADING_HWFN(cdev), (u16)vfid, true); 4407 + if (!vf) 4408 + return -EINVAL; 4409 + 4407 4410 vport_id = vf->vport_id; 4408 4411 4409 4412 return qed_configure_vport_wfq(cdev, vport_id, rate); ··· 5155 5152 5156 5153 /* Validate that the VF has a configured vport */ 5157 5154 vf = qed_iov_get_vf_info(hwfn, i, true); 5158 - if (!vf->vport_instance) 5155 + if (!vf || !vf->vport_instance) 5159 5156 continue; 5160 5157 5161 5158 memset(&params, 0, sizeof(params));
+6
drivers/net/ethernet/qualcomm/emac/emac.c
··· 724 724 struct net_device *netdev = dev_get_drvdata(&pdev->dev); 725 725 struct emac_adapter *adpt = netdev_priv(netdev); 726 726 727 + netif_carrier_off(netdev); 728 + netif_tx_disable(netdev); 729 + 727 730 unregister_netdev(netdev); 728 731 netif_napi_del(&adpt->rx_q.napi); 732 + 733 + free_irq(adpt->irq.irq, &adpt->irq); 734 + cancel_work_sync(&adpt->work_thread); 729 735 730 736 emac_clks_teardown(adpt); 731 737
+1
drivers/net/ethernet/stmicro/stmmac/common.h
··· 418 418 unsigned int frpbs; 419 419 unsigned int frpes; 420 420 unsigned int addr64; 421 + unsigned int host_dma_width; 421 422 unsigned int rssen; 422 423 unsigned int vlhash; 423 424 unsigned int sphen;
+1 -1
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
··· 288 288 goto err_parse_dt; 289 289 } 290 290 291 - plat_dat->addr64 = dwmac->ops->addr_width; 291 + plat_dat->host_dma_width = dwmac->ops->addr_width; 292 292 plat_dat->init = imx_dwmac_init; 293 293 plat_dat->exit = imx_dwmac_exit; 294 294 plat_dat->clks_config = imx_dwmac_clks_config;
+2 -2
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
··· 684 684 685 685 intel_priv->is_pse = true; 686 686 plat->bus_id = 2; 687 - plat->addr64 = 32; 687 + plat->host_dma_width = 32; 688 688 689 689 plat->clk_ptp_rate = 200000000; 690 690 ··· 725 725 726 726 intel_priv->is_pse = true; 727 727 plat->bus_id = 3; 728 - plat->addr64 = 32; 728 + plat->host_dma_width = 32; 729 729 730 730 plat->clk_ptp_rate = 200000000; 731 731
+1 -1
drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
··· 591 591 plat->use_phy_wol = priv_plat->mac_wol ? 0 : 1; 592 592 plat->riwt_off = 1; 593 593 plat->maxmtu = ETH_DATA_LEN; 594 - plat->addr64 = priv_plat->variant->dma_bit_mask; 594 + plat->host_dma_width = priv_plat->variant->dma_bit_mask; 595 595 plat->bsp_priv = priv_plat; 596 596 plat->init = mediatek_dwmac_init; 597 597 plat->clks_config = mediatek_dwmac_clks_config;
+16 -14
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 1431 1431 struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i]; 1432 1432 gfp_t gfp = (GFP_ATOMIC | __GFP_NOWARN); 1433 1433 1434 - if (priv->dma_cap.addr64 <= 32) 1434 + if (priv->dma_cap.host_dma_width <= 32) 1435 1435 gfp |= GFP_DMA32; 1436 1436 1437 1437 if (!buf->page) { ··· 4587 4587 unsigned int entry = rx_q->dirty_rx; 4588 4588 gfp_t gfp = (GFP_ATOMIC | __GFP_NOWARN); 4589 4589 4590 - if (priv->dma_cap.addr64 <= 32) 4590 + if (priv->dma_cap.host_dma_width <= 32) 4591 4591 gfp |= GFP_DMA32; 4592 4592 4593 4593 while (dirty-- > 0) { ··· 6205 6205 seq_printf(seq, "\tFlexible RX Parser: %s\n", 6206 6206 priv->dma_cap.frpsel ? "Y" : "N"); 6207 6207 seq_printf(seq, "\tEnhanced Addressing: %d\n", 6208 - priv->dma_cap.addr64); 6208 + priv->dma_cap.host_dma_width); 6209 6209 seq_printf(seq, "\tReceive Side Scaling: %s\n", 6210 6210 priv->dma_cap.rssen ? "Y" : "N"); 6211 6211 seq_printf(seq, "\tVLAN Hash Filtering: %s\n", ··· 7178 7178 dev_info(priv->device, "SPH feature enabled\n"); 7179 7179 } 7180 7180 7181 - /* The current IP register MAC_HW_Feature1[ADDR64] only define 7182 - * 32/40/64 bit width, but some SOC support others like i.MX8MP 7183 - * support 34 bits but it map to 40 bits width in MAC_HW_Feature1[ADDR64]. 7184 - * So overwrite dma_cap.addr64 according to HW real design. 7181 + /* Ideally our host DMA address width is the same as for the 7182 + * device. However, it may differ and then we have to use our 7183 + * host DMA width for allocation and the device DMA width for 7184 + * register handling. 7185 7185 */ 7186 - if (priv->plat->addr64) 7187 - priv->dma_cap.addr64 = priv->plat->addr64; 7186 + if (priv->plat->host_dma_width) 7187 + priv->dma_cap.host_dma_width = priv->plat->host_dma_width; 7188 + else 7189 + priv->dma_cap.host_dma_width = priv->dma_cap.addr64; 7188 7190 7189 - if (priv->dma_cap.addr64) { 7191 + if (priv->dma_cap.host_dma_width) { 7190 7192 ret = dma_set_mask_and_coherent(device, 7191 - DMA_BIT_MASK(priv->dma_cap.addr64)); 7193 + DMA_BIT_MASK(priv->dma_cap.host_dma_width)); 7192 7194 if (!ret) { 7193 - dev_info(priv->device, "Using %d bits DMA width\n", 7194 - priv->dma_cap.addr64); 7195 + dev_info(priv->device, "Using %d/%d bits DMA host/device width\n", 7196 + priv->dma_cap.host_dma_width, priv->dma_cap.addr64); 7195 7197 7196 7198 /* 7197 7199 * If more than 32 bits can be addressed, make sure to ··· 7208 7206 goto error_hw_init; 7209 7207 } 7210 7208 7211 - priv->dma_cap.addr64 = 32; 7209 + priv->dma_cap.host_dma_width = 32; 7212 7210 } 7213 7211 } 7214 7212
+4
drivers/net/ethernet/ti/am65-cpts.c
··· 650 650 val = lower_32_bits(cycles); 651 651 am65_cpts_write32(cpts, val, genf[req->index].length); 652 652 653 + am65_cpts_write32(cpts, 0, genf[req->index].control); 654 + am65_cpts_write32(cpts, 0, genf[req->index].ppm_hi); 655 + am65_cpts_write32(cpts, 0, genf[req->index].ppm_low); 656 + 653 657 cpts->genf_enable |= BIT(req->index); 654 658 } else { 655 659 am65_cpts_write32(cpts, 0, genf[req->index].length);
+23 -20
drivers/net/ethernet/toshiba/ps3_gelic_net.c
··· 317 317 318 318 /* set up the hardware pointers in each descriptor */ 319 319 for (i = 0; i < no; i++, descr++) { 320 - gelic_descr_set_status(descr, GELIC_DESCR_DMA_NOT_IN_USE); 321 - descr->bus_addr = 322 - dma_map_single(ctodev(card), descr, 323 - GELIC_DESCR_SIZE, 324 - DMA_BIDIRECTIONAL); 320 + dma_addr_t cpu_addr; 325 321 326 - if (!descr->bus_addr) 322 + gelic_descr_set_status(descr, GELIC_DESCR_DMA_NOT_IN_USE); 323 + 324 + cpu_addr = dma_map_single(ctodev(card), descr, 325 + GELIC_DESCR_SIZE, DMA_BIDIRECTIONAL); 326 + 327 + if (dma_mapping_error(ctodev(card), cpu_addr)) 327 328 goto iommu_error; 328 329 330 + descr->bus_addr = cpu_to_be32(cpu_addr); 329 331 descr->next = descr + 1; 330 332 descr->prev = descr - 1; 331 333 } ··· 367 365 * 368 366 * allocates a new rx skb, iommu-maps it and attaches it to the descriptor. 369 367 * Activate the descriptor state-wise 368 + * 369 + * Gelic RX sk_buffs must be aligned to GELIC_NET_RXBUF_ALIGN and the length 370 + * must be a multiple of GELIC_NET_RXBUF_ALIGN. 370 371 */ 371 372 static int gelic_descr_prepare_rx(struct gelic_card *card, 372 373 struct gelic_descr *descr) 373 374 { 375 + static const unsigned int rx_skb_size = 376 + ALIGN(GELIC_NET_MAX_FRAME, GELIC_NET_RXBUF_ALIGN) + 377 + GELIC_NET_RXBUF_ALIGN - 1; 378 + dma_addr_t cpu_addr; 374 379 int offset; 375 - unsigned int bufsize; 376 380 377 381 if (gelic_descr_get_status(descr) != GELIC_DESCR_DMA_NOT_IN_USE) 378 382 dev_info(ctodev(card), "%s: ERROR status\n", __func__); 379 - /* we need to round up the buffer size to a multiple of 128 */ 380 - bufsize = ALIGN(GELIC_NET_MAX_MTU, GELIC_NET_RXBUF_ALIGN); 381 383 382 - /* and we need to have it 128 byte aligned, therefore we allocate a 383 - * bit more */ 384 - descr->skb = dev_alloc_skb(bufsize + GELIC_NET_RXBUF_ALIGN - 1); 384 + descr->skb = netdev_alloc_skb(*card->netdev, rx_skb_size); 385 385 if (!descr->skb) { 386 386 descr->buf_addr = 0; /* tell DMAC don't touch memory */ 387 387 return -ENOMEM; 388 388 } 389 - descr->buf_size = cpu_to_be32(bufsize); 389 + descr->buf_size = cpu_to_be32(rx_skb_size); 390 390 descr->dmac_cmd_status = 0; 391 391 descr->result_size = 0; 392 392 descr->valid_size = 0; ··· 399 395 if (offset) 400 396 skb_reserve(descr->skb, GELIC_NET_RXBUF_ALIGN - offset); 401 397 /* io-mmu-map the skb */ 402 - descr->buf_addr = cpu_to_be32(dma_map_single(ctodev(card), 403 - descr->skb->data, 404 - GELIC_NET_MAX_MTU, 405 - DMA_FROM_DEVICE)); 406 - if (!descr->buf_addr) { 398 + cpu_addr = dma_map_single(ctodev(card), descr->skb->data, 399 + GELIC_NET_MAX_FRAME, DMA_FROM_DEVICE); 400 + descr->buf_addr = cpu_to_be32(cpu_addr); 401 + if (dma_mapping_error(ctodev(card), cpu_addr)) { 407 402 dev_kfree_skb_any(descr->skb); 408 403 descr->skb = NULL; 409 404 dev_info(ctodev(card), ··· 782 779 783 780 buf = dma_map_single(ctodev(card), skb->data, skb->len, DMA_TO_DEVICE); 784 781 785 - if (!buf) { 782 + if (dma_mapping_error(ctodev(card), buf)) { 786 783 dev_err(ctodev(card), 787 784 "dma map 2 failed (%p, %i). Dropping packet\n", 788 785 skb->data, skb->len); ··· 918 915 data_error = be32_to_cpu(descr->data_error); 919 916 /* unmap skb buffer */ 920 917 dma_unmap_single(ctodev(card), be32_to_cpu(descr->buf_addr), 921 - GELIC_NET_MAX_MTU, 918 + GELIC_NET_MAX_FRAME, 922 919 DMA_FROM_DEVICE); 923 920 924 921 skb_put(skb, be32_to_cpu(descr->valid_size)?
+3 -2
drivers/net/ethernet/toshiba/ps3_gelic_net.h
··· 19 19 #define GELIC_NET_RX_DESCRIPTORS 128 /* num of descriptors */ 20 20 #define GELIC_NET_TX_DESCRIPTORS 128 /* num of descriptors */ 21 21 22 - #define GELIC_NET_MAX_MTU VLAN_ETH_FRAME_LEN 23 - #define GELIC_NET_MIN_MTU VLAN_ETH_ZLEN 22 + #define GELIC_NET_MAX_FRAME 2312 23 + #define GELIC_NET_MAX_MTU 2294 24 + #define GELIC_NET_MIN_MTU 64 24 25 #define GELIC_NET_RXBUF_ALIGN 128 25 26 #define GELIC_CARD_RX_CSUM_DEFAULT 1 /* hw chksum */ 26 27 #define GELIC_NET_WATCHDOG_TIMEOUT 5*HZ
+5
drivers/net/ethernet/xircom/xirc2ps_cs.c
··· 503 503 xirc2ps_detach(struct pcmcia_device *link) 504 504 { 505 505 struct net_device *dev = link->priv; 506 + struct local_info *local = netdev_priv(dev); 507 + 508 + netif_carrier_off(dev); 509 + netif_tx_disable(dev); 510 + cancel_work_sync(&local->tx_timeout_task); 506 511 507 512 dev_dbg(&link->dev, "detach\n"); 508 513
+6 -4
drivers/net/mdio/acpi_mdio.c
··· 18 18 MODULE_LICENSE("GPL"); 19 19 20 20 /** 21 - * acpi_mdiobus_register - Register mii_bus and create PHYs from the ACPI ASL. 21 + * __acpi_mdiobus_register - Register mii_bus and create PHYs from the ACPI ASL. 22 22 * @mdio: pointer to mii_bus structure 23 23 * @fwnode: pointer to fwnode of MDIO bus. This fwnode is expected to represent 24 + * @owner: module owning this @mdio object. 24 25 * an ACPI device object corresponding to the MDIO bus and its children are 25 26 * expected to correspond to the PHY devices on that bus. 26 27 * 27 28 * This function registers the mii_bus structure and registers a phy_device 28 29 * for each child node of @fwnode. 29 30 */ 30 - int acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode) 31 + int __acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode, 32 + struct module *owner) 31 33 { 32 34 struct fwnode_handle *child; 33 35 u32 addr; ··· 37 35 38 36 /* Mask out all PHYs from auto probing. */ 39 37 mdio->phy_mask = GENMASK(31, 0); 40 - ret = mdiobus_register(mdio); 38 + ret = __mdiobus_register(mdio, owner); 41 39 if (ret) 42 40 return ret; 43 41 ··· 57 55 } 58 56 return 0; 59 57 } 60 - EXPORT_SYMBOL(acpi_mdiobus_register); 58 + EXPORT_SYMBOL(__acpi_mdiobus_register);
+1
drivers/net/mdio/mdio-thunder.c
··· 106 106 if (i >= ARRAY_SIZE(nexus->buses)) 107 107 break; 108 108 } 109 + fwnode_handle_put(fwn); 109 110 return 0; 110 111 111 112 err_release_regions:
+7 -5
drivers/net/mdio/of_mdio.c
··· 139 139 EXPORT_SYMBOL(of_mdiobus_child_is_phy); 140 140 141 141 /** 142 - * of_mdiobus_register - Register mii_bus and create PHYs from the device tree 142 + * __of_mdiobus_register - Register mii_bus and create PHYs from the device tree 143 143 * @mdio: pointer to mii_bus structure 144 144 * @np: pointer to device_node of MDIO bus. 145 + * @owner: module owning the @mdio object. 145 146 * 146 147 * This function registers the mii_bus structure and registers a phy_device 147 148 * for each child node of @np. 148 149 */ 149 - int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) 150 + int __of_mdiobus_register(struct mii_bus *mdio, struct device_node *np, 151 + struct module *owner) 150 152 { 151 153 struct device_node *child; 152 154 bool scanphys = false; 153 155 int addr, rc; 154 156 155 157 if (!np) 156 - return mdiobus_register(mdio); 158 + return __mdiobus_register(mdio, owner); 157 159 158 160 /* Do not continue if the node is disabled */ 159 161 if (!of_device_is_available(np)) ··· 174 172 of_property_read_u32(np, "reset-post-delay-us", &mdio->reset_post_delay_us); 175 173 176 174 /* Register the MDIO bus */ 177 - rc = mdiobus_register(mdio); 175 + rc = __mdiobus_register(mdio, owner); 178 176 if (rc) 179 177 return rc; 180 178 ··· 238 236 mdiobus_unregister(mdio); 239 237 return rc; 240 238 } 241 - EXPORT_SYMBOL(of_mdiobus_register); 239 + EXPORT_SYMBOL(__of_mdiobus_register); 242 240 243 241 /** 244 242 * of_mdio_find_device - Given a device tree node, find the mdio_device
+6 -5
drivers/net/phy/mdio_devres.c
··· 98 98 99 99 #if IS_ENABLED(CONFIG_OF_MDIO) 100 100 /** 101 - * devm_of_mdiobus_register - Resource managed variant of of_mdiobus_register() 101 + * __devm_of_mdiobus_register - Resource managed variant of of_mdiobus_register() 102 102 * @dev: Device to register mii_bus for 103 103 * @mdio: MII bus structure to register 104 104 * @np: Device node to parse 105 + * @owner: Owning module 105 106 */ 106 - int devm_of_mdiobus_register(struct device *dev, struct mii_bus *mdio, 107 - struct device_node *np) 107 + int __devm_of_mdiobus_register(struct device *dev, struct mii_bus *mdio, 108 + struct device_node *np, struct module *owner) 108 109 { 109 110 struct mdiobus_devres *dr; 110 111 int ret; ··· 118 117 if (!dr) 119 118 return -ENOMEM; 120 119 121 - ret = of_mdiobus_register(mdio, np); 120 + ret = __of_mdiobus_register(mdio, np, owner); 122 121 if (ret) { 123 122 devres_free(dr); 124 123 return ret; ··· 128 127 devres_add(dev, dr); 129 128 return 0; 130 129 } 131 - EXPORT_SYMBOL(devm_of_mdiobus_register); 130 + EXPORT_SYMBOL(__devm_of_mdiobus_register); 132 131 #endif /* CONFIG_OF_MDIO */ 133 132 134 133 MODULE_LICENSE("GPL");
+16 -7
drivers/net/phy/phy.c
··· 57 57 return NULL; 58 58 } 59 59 60 + static void phy_process_state_change(struct phy_device *phydev, 61 + enum phy_state old_state) 62 + { 63 + if (old_state != phydev->state) { 64 + phydev_dbg(phydev, "PHY state change %s -> %s\n", 65 + phy_state_to_str(old_state), 66 + phy_state_to_str(phydev->state)); 67 + if (phydev->drv && phydev->drv->link_change_notify) 68 + phydev->drv->link_change_notify(phydev); 69 + } 70 + } 71 + 60 72 static void phy_link_up(struct phy_device *phydev) 61 73 { 62 74 phydev->phy_link_change(phydev, true); ··· 1324 1312 void phy_stop(struct phy_device *phydev) 1325 1313 { 1326 1314 struct net_device *dev = phydev->attached_dev; 1315 + enum phy_state old_state; 1327 1316 1328 1317 if (!phy_is_started(phydev) && phydev->state != PHY_DOWN) { 1329 1318 WARN(1, "called from state %s\n", ··· 1333 1320 } 1334 1321 1335 1322 mutex_lock(&phydev->lock); 1323 + old_state = phydev->state; 1336 1324 1337 1325 if (phydev->state == PHY_CABLETEST) { 1338 1326 phy_abort_cable_test(phydev); ··· 1344 1330 sfp_upstream_stop(phydev->sfp_bus); 1345 1331 1346 1332 phydev->state = PHY_HALTED; 1333 + phy_process_state_change(phydev, old_state); 1347 1334 1348 1335 mutex_unlock(&phydev->lock); 1349 1336 ··· 1466 1451 if (err < 0) 1467 1452 phy_error_precise(phydev, func, err); 1468 1453 1469 - if (old_state != phydev->state) { 1470 - phydev_dbg(phydev, "PHY state change %s -> %s\n", 1471 - phy_state_to_str(old_state), 1472 - phy_state_to_str(phydev->state)); 1473 - if (phydev->drv && phydev->drv->link_change_notify) 1474 - phydev->drv->link_change_notify(phydev); 1475 - } 1454 + phy_process_state_change(phydev, old_state); 1476 1455 1477 1456 /* Only re-schedule a PHY state machine change if we are polling the 1478 1457 * PHY, if PHY_MAC_INTERRUPT is set, then we will be moving
+5
drivers/net/phy/sfp.c
··· 2214 2214 break; 2215 2215 } 2216 2216 2217 + /* Force a poll to re-read the hardware signal state after 2218 + * sfp_sm_mod_probe() changed state_hw_mask. 2219 + */ 2220 + mod_delayed_work(system_wq, &sfp->poll, 1); 2221 + 2217 2222 err = sfp_hwmon_insert(sfp); 2218 2223 if (err) 2219 2224 dev_warn(sfp->dev, "hwmon probe failed: %pe\n",
+27 -5
drivers/net/usb/asix_devices.c
··· 666 666 static int ax88772_init_mdio(struct usbnet *dev) 667 667 { 668 668 struct asix_common_private *priv = dev->driver_priv; 669 + int ret; 669 670 670 - priv->mdio = devm_mdiobus_alloc(&dev->udev->dev); 671 + priv->mdio = mdiobus_alloc(); 671 672 if (!priv->mdio) 672 673 return -ENOMEM; 673 674 ··· 680 679 snprintf(priv->mdio->id, MII_BUS_ID_SIZE, "usb-%03d:%03d", 681 680 dev->udev->bus->busnum, dev->udev->devnum); 682 681 683 - return devm_mdiobus_register(&dev->udev->dev, priv->mdio); 682 + ret = mdiobus_register(priv->mdio); 683 + if (ret) { 684 + netdev_err(dev->net, "Could not register MDIO bus (err %d)\n", ret); 685 + mdiobus_free(priv->mdio); 686 + priv->mdio = NULL; 687 + } 688 + 689 + return ret; 690 + } 691 + 692 + static void ax88772_mdio_unregister(struct asix_common_private *priv) 693 + { 694 + mdiobus_unregister(priv->mdio); 695 + mdiobus_free(priv->mdio); 684 696 } 685 697 686 698 static int ax88772_init_phy(struct usbnet *dev) ··· 910 896 911 897 ret = ax88772_init_mdio(dev); 912 898 if (ret) 913 - return ret; 899 + goto mdio_err; 914 900 915 901 ret = ax88772_phylink_setup(dev); 916 902 if (ret) 917 - return ret; 903 + goto phylink_err; 918 904 919 905 ret = ax88772_init_phy(dev); 920 906 if (ret) 921 - phylink_destroy(priv->phylink); 907 + goto initphy_err; 922 908 909 + return 0; 910 + 911 + initphy_err: 912 + phylink_destroy(priv->phylink); 913 + phylink_err: 914 + ax88772_mdio_unregister(priv); 915 + mdio_err: 923 916 return ret; 924 917 } 925 918 ··· 947 926 phylink_disconnect_phy(priv->phylink); 948 927 rtnl_unlock(); 949 928 phylink_destroy(priv->phylink); 929 + ax88772_mdio_unregister(priv); 950 930 asix_rx_fixup_common_free(dev->driver_priv); 951 931 } 952 932
+17 -1
drivers/net/usb/lan78xx.c
··· 3579 3579 size = (rx_cmd_a & RX_CMD_A_LEN_MASK_); 3580 3580 align_count = (4 - ((size + RXW_PADDING) % 4)) % 4; 3581 3581 3582 + if (unlikely(size > skb->len)) { 3583 + netif_dbg(dev, rx_err, dev->net, 3584 + "size err rx_cmd_a=0x%08x\n", 3585 + rx_cmd_a); 3586 + return 0; 3587 + } 3588 + 3582 3589 if (unlikely(rx_cmd_a & RX_CMD_A_RED_)) { 3583 3590 netif_dbg(dev, rx_err, dev->net, 3584 3591 "Error rx_cmd_a=0x%08x", rx_cmd_a); 3585 3592 } else { 3586 - u32 frame_len = size - ETH_FCS_LEN; 3593 + u32 frame_len; 3587 3594 struct sk_buff *skb2; 3595 + 3596 + if (unlikely(size < ETH_FCS_LEN)) { 3597 + netif_dbg(dev, rx_err, dev->net, 3598 + "size err rx_cmd_a=0x%08x\n", 3599 + rx_cmd_a); 3600 + return 0; 3601 + } 3602 + 3603 + frame_len = size - ETH_FCS_LEN; 3588 3604 3589 3605 skb2 = napi_alloc_skb(&dev->napi, frame_len); 3590 3606 if (!skb2)
-6
drivers/net/usb/plusb.c
··· 62 62 } 63 63 64 64 static inline int 65 - pl_clear_QuickLink_features(struct usbnet *dev, int val) 66 - { 67 - return pl_vendor_req(dev, 1, (u8) val, 0); 68 - } 69 - 70 - static inline int 71 65 pl_set_QuickLink_features(struct usbnet *dev, int val) 72 66 { 73 67 return pl_vendor_req(dev, 3, (u8) val, 0);
+6
drivers/net/usb/smsc95xx.c
··· 1833 1833 size = (u16)((header & RX_STS_FL_) >> 16); 1834 1834 align_count = (4 - ((size + NET_IP_ALIGN) % 4)) % 4; 1835 1835 1836 + if (unlikely(size > skb->len)) { 1837 + netif_dbg(dev, rx_err, dev->net, 1838 + "size err header=0x%08x\n", header); 1839 + return 0; 1840 + } 1841 + 1836 1842 if (unlikely(header & RX_STS_ES_)) { 1837 1843 netif_dbg(dev, rx_err, dev->net, 1838 1844 "Error header=0x%08x\n", header);
+2 -2
drivers/net/veth.c
··· 1642 1642 struct veth_xdp_buff *_ctx = (void *)ctx; 1643 1643 1644 1644 if (!_ctx->skb) 1645 - return -EOPNOTSUPP; 1645 + return -ENODATA; 1646 1646 1647 1647 *timestamp = skb_hwtstamps(_ctx->skb)->hwtstamp; 1648 1648 return 0; ··· 1653 1653 struct veth_xdp_buff *_ctx = (void *)ctx; 1654 1654 1655 1655 if (!_ctx->skb) 1656 - return -EOPNOTSUPP; 1656 + return -ENODATA; 1657 1657 1658 1658 *hash = skb_get_hash(_ctx->skb); 1659 1659 return 0;
+18 -32
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
··· 732 732 733 733 rcu_read_lock(); 734 734 do { 735 - while (likely(!mvmtxq->stopped && 735 + while (likely(!test_bit(IWL_MVM_TXQ_STATE_STOP_FULL, 736 + &mvmtxq->state) && 737 + !test_bit(IWL_MVM_TXQ_STATE_STOP_REDIRECT, 738 + &mvmtxq->state) && 736 739 !test_bit(IWL_MVM_STATUS_IN_D3, &mvm->status))) { 737 740 skb = ieee80211_tx_dequeue(hw, txq); 738 741 ··· 760 757 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); 761 758 struct iwl_mvm_txq *mvmtxq = iwl_mvm_txq_from_mac80211(txq); 762 759 763 - /* 764 - * Please note that racing is handled very carefully here: 765 - * mvmtxq->txq_id is updated during allocation, and mvmtxq->list is 766 - * deleted afterwards. 767 - * This means that if: 768 - * mvmtxq->txq_id != INVALID_QUEUE && list_empty(&mvmtxq->list): 769 - * queue is allocated and we can TX. 770 - * mvmtxq->txq_id != INVALID_QUEUE && !list_empty(&mvmtxq->list): 771 - * a race, should defer the frame. 772 - * mvmtxq->txq_id == INVALID_QUEUE && list_empty(&mvmtxq->list): 773 - * need to allocate the queue and defer the frame. 774 - * mvmtxq->txq_id == INVALID_QUEUE && !list_empty(&mvmtxq->list): 775 - * queue is already scheduled for allocation, no need to allocate, 776 - * should defer the frame. 777 - */ 778 - 779 - /* If the queue is allocated TX and return. */ 780 - if (!txq->sta || mvmtxq->txq_id != IWL_MVM_INVALID_QUEUE) { 781 - /* 782 - * Check that list is empty to avoid a race where txq_id is 783 - * already updated, but the queue allocation work wasn't 784 - * finished 785 - */ 786 - if (unlikely(txq->sta && !list_empty(&mvmtxq->list))) 787 - return; 788 - 760 + if (likely(test_bit(IWL_MVM_TXQ_STATE_READY, &mvmtxq->state)) || 761 + !txq->sta) { 789 762 iwl_mvm_mac_itxq_xmit(hw, txq); 790 763 return; 791 764 } 792 765 793 - /* The list is being deleted only after the queue is fully allocated. */ 794 - if (!list_empty(&mvmtxq->list)) 795 - return; 766 + /* iwl_mvm_mac_itxq_xmit() will later be called by the worker 767 + * to handle any packets we leave on the txq now 768 + */ 796 769 797 - list_add_tail(&mvmtxq->list, &mvm->add_stream_txqs); 798 - schedule_work(&mvm->add_stream_wk); 770 + spin_lock_bh(&mvm->add_stream_lock); 771 + /* The list is being deleted only after the queue is fully allocated. */ 772 + if (list_empty(&mvmtxq->list) && 773 + /* recheck under lock */ 774 + !test_bit(IWL_MVM_TXQ_STATE_READY, &mvmtxq->state)) { 775 + list_add_tail(&mvmtxq->list, &mvm->add_stream_txqs); 776 + schedule_work(&mvm->add_stream_wk); 777 + } 778 + spin_unlock_bh(&mvm->add_stream_lock); 799 779 } 800 780 801 781 #define CHECK_BA_TRIGGER(_mvm, _trig, _tid_bm, _tid, _fmt...) \
+5 -1
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
··· 729 729 struct list_head list; 730 730 u16 txq_id; 731 731 atomic_t tx_request; 732 - bool stopped; 732 + #define IWL_MVM_TXQ_STATE_STOP_FULL 0 733 + #define IWL_MVM_TXQ_STATE_STOP_REDIRECT 1 734 + #define IWL_MVM_TXQ_STATE_READY 2 735 + unsigned long state; 733 736 }; 734 737 735 738 static inline struct iwl_mvm_txq * ··· 830 827 struct iwl_mvm_tvqm_txq_info tvqm_info[IWL_MAX_TVQM_QUEUES]; 831 828 }; 832 829 struct work_struct add_stream_wk; /* To add streams to queues */ 830 + spinlock_t add_stream_lock; 833 831 834 832 const char *nvm_file_name; 835 833 struct iwl_nvm_data *nvm_data;
+5 -1
drivers/net/wireless/intel/iwlwifi/mvm/ops.c
··· 1195 1195 INIT_DELAYED_WORK(&mvm->scan_timeout_dwork, iwl_mvm_scan_timeout_wk); 1196 1196 INIT_WORK(&mvm->add_stream_wk, iwl_mvm_add_new_dqa_stream_wk); 1197 1197 INIT_LIST_HEAD(&mvm->add_stream_txqs); 1198 + spin_lock_init(&mvm->add_stream_lock); 1198 1199 1199 1200 init_waitqueue_head(&mvm->rx_sync_waitq); 1200 1201 ··· 1692 1691 1693 1692 txq = sta->txq[tid]; 1694 1693 mvmtxq = iwl_mvm_txq_from_mac80211(txq); 1695 - mvmtxq->stopped = !start; 1694 + if (start) 1695 + clear_bit(IWL_MVM_TXQ_STATE_STOP_FULL, &mvmtxq->state); 1696 + else 1697 + set_bit(IWL_MVM_TXQ_STATE_STOP_FULL, &mvmtxq->state); 1696 1698 1697 1699 if (start && mvmsta->sta_state != IEEE80211_STA_NOTEXIST) 1698 1700 iwl_mvm_mac_itxq_xmit(mvm->hw, txq);
+24 -5
drivers/net/wireless/intel/iwlwifi/mvm/sta.c
··· 384 384 struct iwl_mvm_txq *mvmtxq = 385 385 iwl_mvm_txq_from_tid(sta, tid); 386 386 387 - mvmtxq->txq_id = IWL_MVM_INVALID_QUEUE; 387 + spin_lock_bh(&mvm->add_stream_lock); 388 388 list_del_init(&mvmtxq->list); 389 + clear_bit(IWL_MVM_TXQ_STATE_READY, &mvmtxq->state); 390 + mvmtxq->txq_id = IWL_MVM_INVALID_QUEUE; 391 + spin_unlock_bh(&mvm->add_stream_lock); 389 392 } 390 393 391 394 /* Regardless if this is a reserved TXQ for a STA - mark it as false */ ··· 482 479 disable_agg_tids |= BIT(tid); 483 480 mvmsta->tid_data[tid].txq_id = IWL_MVM_INVALID_QUEUE; 484 481 485 - mvmtxq->txq_id = IWL_MVM_INVALID_QUEUE; 482 + spin_lock_bh(&mvm->add_stream_lock); 486 483 list_del_init(&mvmtxq->list); 484 + clear_bit(IWL_MVM_TXQ_STATE_READY, &mvmtxq->state); 485 + mvmtxq->txq_id = IWL_MVM_INVALID_QUEUE; 486 + spin_unlock_bh(&mvm->add_stream_lock); 487 487 } 488 488 489 489 mvmsta->tfd_queue_msk &= ~BIT(queue); /* Don't use this queue anymore */ ··· 699 693 queue, iwl_mvm_ac_to_tx_fifo[ac]); 700 694 701 695 /* Stop the queue and wait for it to empty */ 702 - txq->stopped = true; 696 + set_bit(IWL_MVM_TXQ_STATE_STOP_REDIRECT, &txq->state); 703 697 704 698 ret = iwl_trans_wait_tx_queues_empty(mvm->trans, BIT(queue)); 705 699 if (ret) { ··· 742 736 743 737 out: 744 738 /* Continue using the queue */ 745 - txq->stopped = false; 739 + clear_bit(IWL_MVM_TXQ_STATE_STOP_REDIRECT, &txq->state); 746 740 747 741 return ret; 748 742 } ··· 1450 1444 * a queue in the function itself. 1451 1445 */ 1452 1446 if (iwl_mvm_sta_alloc_queue(mvm, txq->sta, txq->ac, tid)) { 1447 + spin_lock_bh(&mvm->add_stream_lock); 1453 1448 list_del_init(&mvmtxq->list); 1449 + spin_unlock_bh(&mvm->add_stream_lock); 1454 1450 continue; 1455 1451 } 1456 1452 1457 - list_del_init(&mvmtxq->list); 1453 + /* now we're ready, any remaining races/concurrency will be 1454 + * handled in iwl_mvm_mac_itxq_xmit() 1455 + */ 1456 + set_bit(IWL_MVM_TXQ_STATE_READY, &mvmtxq->state); 1457 + 1458 1458 local_bh_disable(); 1459 + spin_lock(&mvm->add_stream_lock); 1460 + list_del_init(&mvmtxq->list); 1461 + spin_unlock(&mvm->add_stream_lock); 1462 + 1459 1463 iwl_mvm_mac_itxq_xmit(mvm->hw, txq); 1460 1464 local_bh_enable(); 1461 1465 } ··· 1880 1864 struct iwl_mvm_txq *mvmtxq = 1881 1865 iwl_mvm_txq_from_mac80211(sta->txq[i]); 1882 1866 1867 + spin_lock_bh(&mvm->add_stream_lock); 1883 1868 mvmtxq->txq_id = IWL_MVM_INVALID_QUEUE; 1884 1869 list_del_init(&mvmtxq->list); 1870 + clear_bit(IWL_MVM_TXQ_STATE_READY, &mvmtxq->state); 1871 + spin_unlock_bh(&mvm->add_stream_lock); 1885 1872 } 1886 1873 } 1887 1874
+1 -1
drivers/net/wireless/marvell/mwifiex/pcie.c
··· 172 172 .can_ext_scan = true, 173 173 }; 174 174 175 - static const struct of_device_id mwifiex_pcie_of_match_table[] = { 175 + static const struct of_device_id mwifiex_pcie_of_match_table[] __maybe_unused = { 176 176 { .compatible = "pci11ab,2b42" }, 177 177 { .compatible = "pci1b4b,2b42" }, 178 178 { }
+1 -1
drivers/net/wireless/marvell/mwifiex/sdio.c
··· 495 495 {"EXTLAST", NULL, 0, 0xFE}, 496 496 }; 497 497 498 - static const struct of_device_id mwifiex_sdio_of_match_table[] = { 498 + static const struct of_device_id mwifiex_sdio_of_match_table[] __maybe_unused = { 499 499 { .compatible = "marvell,sd8787" }, 500 500 { .compatible = "marvell,sd8897" }, 501 501 { .compatible = "marvell,sd8978" },
+8
drivers/net/wireless/mediatek/mt76/mac80211.c
··· 539 539 if (ret) 540 540 return ret; 541 541 542 + set_bit(MT76_STATE_REGISTERED, &phy->state); 542 543 phy->dev->phys[phy->band_idx] = phy; 543 544 544 545 return 0; ··· 549 548 void mt76_unregister_phy(struct mt76_phy *phy) 550 549 { 551 550 struct mt76_dev *dev = phy->dev; 551 + 552 + if (!test_bit(MT76_STATE_REGISTERED, &phy->state)) 553 + return; 552 554 553 555 if (IS_ENABLED(CONFIG_MT76_LEDS)) 554 556 mt76_led_cleanup(phy); ··· 723 719 return ret; 724 720 725 721 WARN_ON(mt76_worker_setup(hw, &dev->tx_worker, NULL, "tx")); 722 + set_bit(MT76_STATE_REGISTERED, &phy->state); 726 723 sched_set_fifo_low(dev->tx_worker.task); 727 724 728 725 return 0; ··· 733 728 void mt76_unregister_device(struct mt76_dev *dev) 734 729 { 735 730 struct ieee80211_hw *hw = dev->hw; 731 + 732 + if (!test_bit(MT76_STATE_REGISTERED, &dev->phy.state)) 733 + return; 736 734 737 735 if (IS_ENABLED(CONFIG_MT76_LEDS)) 738 736 mt76_led_cleanup(&dev->phy);
+1
drivers/net/wireless/mediatek/mt76/mt76.h
··· 402 402 403 403 enum { 404 404 MT76_STATE_INITIALIZED, 405 + MT76_STATE_REGISTERED, 405 406 MT76_STATE_RUNNING, 406 407 MT76_STATE_MCU_RUNNING, 407 408 MT76_SCANNING,
+3
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
··· 1221 1221 1222 1222 int mt76_connac_mcu_sta_wed_update(struct mt76_dev *dev, struct sk_buff *skb) 1223 1223 { 1224 + if (!mt76_is_mmio(dev)) 1225 + return 0; 1226 + 1224 1227 if (!mtk_wed_device_active(&dev->mmio.wed)) 1225 1228 return 0; 1226 1229
+30 -10
drivers/net/wireless/mediatek/mt76/mt7915/init.c
··· 383 383 ieee80211_hw_set(hw, SUPPORTS_RX_DECAP_OFFLOAD); 384 384 ieee80211_hw_set(hw, SUPPORTS_MULTI_BSSID); 385 385 ieee80211_hw_set(hw, WANT_MONITOR_VIF); 386 - ieee80211_hw_set(hw, SUPPORTS_VHT_EXT_NSS_BW); 387 386 388 387 hw->max_tx_fragments = 4; 389 388 ··· 395 396 } 396 397 397 398 if (phy->mt76->cap.has_5ghz) { 399 + struct ieee80211_sta_vht_cap *vht_cap; 400 + 401 + vht_cap = &phy->mt76->sband_5g.sband.vht_cap; 398 402 phy->mt76->sband_5g.sband.ht_cap.cap |= 399 403 IEEE80211_HT_CAP_LDPC_CODING | 400 404 IEEE80211_HT_CAP_MAX_AMSDU; ··· 405 403 IEEE80211_HT_MPDU_DENSITY_4; 406 404 407 405 if (is_mt7915(&dev->mt76)) { 408 - phy->mt76->sband_5g.sband.vht_cap.cap |= 406 + vht_cap->cap |= 409 407 IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 | 410 408 IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK; 409 + 410 + if (!dev->dbdc_support) 411 + vht_cap->cap |= 412 + IEEE80211_VHT_CAP_SHORT_GI_160 | 413 + IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ | 414 + FIELD_PREP(IEEE80211_VHT_CAP_EXT_NSS_BW_MASK, 1); 411 415 } else { 412 - phy->mt76->sband_5g.sband.vht_cap.cap |= 416 + vht_cap->cap |= 413 417 IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 | 414 418 IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK; 415 419 416 420 /* mt7916 dbdc with 2g 2x2 bw40 and 5g 2x2 bw160c */ 417 - phy->mt76->sband_5g.sband.vht_cap.cap |= 421 + vht_cap->cap |= 418 422 IEEE80211_VHT_CAP_SHORT_GI_160 | 419 423 IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; 420 424 } 425 + 426 + if (!is_mt7915(&dev->mt76) || !dev->dbdc_support) 427 + ieee80211_hw_set(hw, SUPPORTS_VHT_EXT_NSS_BW); 421 428 } 422 429 423 430 mt76_set_stream_caps(phy->mt76, true); ··· 852 841 int sts = hweight8(phy->mt76->chainmask); 853 842 u8 c, sts_160 = sts; 854 843 855 - /* mt7915 doesn't support bw160 */ 856 - if (is_mt7915(&dev->mt76)) 857 - sts_160 = 0; 844 + /* Can do 1/2 of STS in 160Mhz mode for mt7915 */ 845 + if (is_mt7915(&dev->mt76)) { 846 + if (!dev->dbdc_support) 847 + sts_160 /= 2; 848 + else 849 + sts_160 = 0; 850 + } 858 851 859 852 #ifdef CONFIG_MAC80211_MESH 860 853 if (vif == NL80211_IFTYPE_MESH_POINT) ··· 959 944 int i, idx = 0, nss = hweight8(phy->mt76->antenna_mask); 960 945 u16 mcs_map = 0; 961 946 u16 mcs_map_160 = 0; 962 - u8 nss_160 = nss; 947 + u8 nss_160; 963 948 964 - /* Can't do 160MHz with mt7915 */ 965 - if (is_mt7915(&dev->mt76)) 949 + if (!is_mt7915(&dev->mt76)) 950 + nss_160 = nss; 951 + else if (!dev->dbdc_support) 952 + /* Can do 1/2 of NSS streams in 160Mhz mode for mt7915 */ 953 + nss_160 = nss / 2; 954 + else 955 + /* Can't do 160MHz with mt7915 dbdc */ 966 956 nss_160 = 0; 967 957 968 958 for (i = 0; i < 8; i++) {
+1 -1
drivers/nvmem/core.c
··· 1231 1231 "#nvmem-cell-cells", 1232 1232 index, &cell_spec); 1233 1233 if (ret) 1234 - return ERR_PTR(ret); 1234 + return ERR_PTR(-ENOENT); 1235 1235 1236 1236 if (cell_spec.args_count > 1) 1237 1237 return ERR_PTR(-EINVAL);
+4 -2
drivers/scsi/device_handler/scsi_dh_alua.c
··· 1145 1145 rcu_read_unlock(); 1146 1146 mutex_unlock(&h->init_mutex); 1147 1147 1148 - if (alua_rtpg_queue(pg, sdev, qdata, true)) 1148 + if (alua_rtpg_queue(pg, sdev, qdata, true)) { 1149 1149 fn = NULL; 1150 - else 1150 + } else { 1151 + kfree(qdata); 1151 1152 err = SCSI_DH_DEV_OFFLINED; 1153 + } 1152 1154 kref_put(&pg->kref, release_port_group); 1153 1155 out: 1154 1156 if (fn)
+2 -1
drivers/scsi/qla2xxx/qla_isr.c
··· 1900 1900 } 1901 1901 1902 1902 req->outstanding_cmds[index] = NULL; 1903 + 1904 + qla_put_fw_resources(sp->qpair, &sp->iores); 1903 1905 return sp; 1904 1906 } 1905 1907 ··· 3114 3112 } 3115 3113 bsg_reply->reply_payload_rcv_len = 0; 3116 3114 3117 - qla_put_fw_resources(sp->qpair, &sp->iores); 3118 3115 done: 3119 3116 /* Return the vendor specific reply to API */ 3120 3117 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = rval;
+11
drivers/scsi/qla2xxx/qla_os.c
··· 1865 1865 for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) { 1866 1866 sp = req->outstanding_cmds[cnt]; 1867 1867 if (sp) { 1868 + /* 1869 + * perform lockless completion during driver unload 1870 + */ 1871 + if (qla2x00_chip_is_down(vha)) { 1872 + req->outstanding_cmds[cnt] = NULL; 1873 + spin_unlock_irqrestore(qp->qp_lock_ptr, flags); 1874 + sp->done(sp, res); 1875 + spin_lock_irqsave(qp->qp_lock_ptr, flags); 1876 + continue; 1877 + } 1878 + 1868 1879 switch (sp->cmd_type) { 1869 1880 case TYPE_SRB: 1870 1881 qla2x00_abort_srb(qp, sp, res, &flags);
+1
drivers/scsi/scsi_devinfo.c
··· 234 234 {"SGI", "RAID5", "*", BLIST_SPARSELUN}, 235 235 {"SGI", "TP9100", "*", BLIST_REPORTLUN2}, 236 236 {"SGI", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, 237 + {"SKhynix", "H28U74301AMR", NULL, BLIST_SKIP_VPD_PAGES}, 237 238 {"IBM", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, 238 239 {"SUN", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, 239 240 {"DELL", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
+1 -1
drivers/tty/serdev/core.c
··· 534 534 if (!serdev) 535 535 continue; 536 536 537 - serdev->dev.of_node = node; 537 + device_set_node(&serdev->dev, of_fwnode_handle(node)); 538 538 539 539 err = serdev_device_add(serdev); 540 540 if (err) {
+2 -2
drivers/tty/serial/8250/8250_em.c
··· 106 106 memset(&up, 0, sizeof(up)); 107 107 up.port.mapbase = regs->start; 108 108 up.port.irq = irq; 109 - up.port.type = PORT_UNKNOWN; 110 - up.port.flags = UPF_BOOT_AUTOCONF | UPF_FIXED_PORT | UPF_IOREMAP; 109 + up.port.type = PORT_16750; 110 + up.port.flags = UPF_FIXED_PORT | UPF_IOREMAP | UPF_FIXED_TYPE; 111 111 up.port.dev = &pdev->dev; 112 112 up.port.private_data = priv; 113 113
+2 -2
drivers/tty/serial/8250/8250_fsl.c
··· 34 34 35 35 iir = port->serial_in(port, UART_IIR); 36 36 if (iir & UART_IIR_NO_INT) { 37 - spin_unlock(&up->port.lock); 37 + spin_unlock_irqrestore(&up->port.lock, flags); 38 38 return 0; 39 39 } 40 40 ··· 42 42 if (unlikely(up->lsr_saved_flags & UART_LSR_BI)) { 43 43 up->lsr_saved_flags &= ~UART_LSR_BI; 44 44 port->serial_in(port, UART_RX); 45 - spin_unlock(&up->port.lock); 45 + spin_unlock_irqrestore(&up->port.lock, flags); 46 46 return 1; 47 47 } 48 48
+2 -2
drivers/tty/serial/8250/Kconfig
··· 257 257 tristate "Aspeed Virtual UART" 258 258 depends on SERIAL_8250 259 259 depends on OF 260 - depends on REGMAP && MFD_SYSCON 260 + depends on MFD_SYSCON 261 261 depends on ARCH_ASPEED || COMPILE_TEST 262 + select REGMAP 262 263 help 263 264 If you want to use the virtual UART (VUART) device on Aspeed 264 265 BMC platforms, enable this option. This enables the 16550A- ··· 300 299 tristate "Microchip 8250 based serial port" 301 300 depends on SERIAL_8250 && PCI 302 301 select SERIAL_8250_PCILIB 303 - default SERIAL_8250 304 302 help 305 303 Select this option if you have a setup with Microchip PCIe 306 304 Switch with serial port enabled and wish to enable 8250
+1 -1
drivers/tty/serial/Kconfig
··· 1313 1313 1314 1314 config SERIAL_FSL_LPUART_CONSOLE 1315 1315 bool "Console on Freescale lpuart serial port" 1316 - depends on SERIAL_FSL_LPUART 1316 + depends on SERIAL_FSL_LPUART=y 1317 1317 select SERIAL_CORE_CONSOLE 1318 1318 select SERIAL_EARLYCON 1319 1319 help
+12 -11
drivers/tty/serial/fsl_lpuart.c
··· 1354 1354 struct dma_chan *chan = sport->dma_rx_chan; 1355 1355 1356 1356 dmaengine_terminate_sync(chan); 1357 + del_timer_sync(&sport->lpuart_timer); 1357 1358 dma_unmap_sg(chan->device->dev, &sport->rx_sgl, 1, DMA_FROM_DEVICE); 1358 1359 kfree(sport->rx_ring.buf); 1359 1360 sport->rx_ring.tail = 0; ··· 1814 1813 static void lpuart_dma_shutdown(struct lpuart_port *sport) 1815 1814 { 1816 1815 if (sport->lpuart_dma_rx_use) { 1817 - del_timer_sync(&sport->lpuart_timer); 1818 1816 lpuart_dma_rx_free(&sport->port); 1819 1817 sport->lpuart_dma_rx_use = false; 1820 1818 } ··· 1973 1973 * Since timer function acqures sport->port.lock, need to stop before 1974 1974 * acquring same lock because otherwise del_timer_sync() can deadlock. 1975 1975 */ 1976 - if (old && sport->lpuart_dma_rx_use) { 1977 - del_timer_sync(&sport->lpuart_timer); 1976 + if (old && sport->lpuart_dma_rx_use) 1978 1977 lpuart_dma_rx_free(&sport->port); 1979 - } 1980 1978 1981 1979 spin_lock_irqsave(&sport->port.lock, flags); 1982 1980 ··· 2208 2210 * Since timer function acqures sport->port.lock, need to stop before 2209 2211 * acquring same lock because otherwise del_timer_sync() can deadlock. 2210 2212 */ 2211 - if (old && sport->lpuart_dma_rx_use) { 2212 - del_timer_sync(&sport->lpuart_timer); 2213 + if (old && sport->lpuart_dma_rx_use) 2213 2214 lpuart_dma_rx_free(&sport->port); 2214 - } 2215 2215 2216 2216 spin_lock_irqsave(&sport->port.lock, flags); 2217 2217 ··· 2236 2240 /* update the per-port timeout */ 2237 2241 uart_update_timeout(port, termios->c_cflag, baud); 2238 2242 2239 - /* wait transmit engin complete */ 2240 - lpuart32_write(&sport->port, 0, UARTMODIR); 2241 - lpuart32_wait_bit_set(&sport->port, UARTSTAT, UARTSTAT_TC); 2243 + /* 2244 + * LPUART Transmission Complete Flag may never be set while queuing a break 2245 + * character, so skip waiting for transmission complete when UARTCTRL_SBK is 2246 + * asserted. 2247 + */ 2248 + if (!(old_ctrl & UARTCTRL_SBK)) { 2249 + lpuart32_write(&sport->port, 0, UARTMODIR); 2250 + lpuart32_wait_bit_set(&sport->port, UARTSTAT, UARTSTAT_TC); 2251 + } 2242 2252 2243 2253 /* disable transmit and receive */ 2244 2254 lpuart32_write(&sport->port, old_ctrl & ~(UARTCTRL_TE | UARTCTRL_RE), ··· 3016 3014 * cannot resume as expected, hence gracefully release the 3017 3015 * Rx DMA path before suspend and start Rx DMA path on resume. 3018 3016 */ 3019 - del_timer_sync(&sport->lpuart_timer); 3020 3017 lpuart_dma_rx_free(&sport->port); 3021 3018 3022 3019 /* Disable Rx DMA to use UART port as wakeup source */
+7 -4
drivers/tty/serial/qcom_geni_serial.c
··· 596 596 if (!qcom_geni_serial_main_active(uport)) 597 597 return; 598 598 599 - if (port->rx_dma_addr) { 599 + if (port->tx_dma_addr) { 600 600 geni_se_tx_dma_unprep(&port->se, port->tx_dma_addr, 601 601 port->tx_remaining); 602 602 port->tx_dma_addr = 0; ··· 631 631 if (port->tx_dma_addr) 632 632 return; 633 633 634 - xmit_size = uart_circ_chars_pending(xmit); 635 - if (xmit_size < WAKEUP_CHARS) 636 - uart_write_wakeup(uport); 634 + if (uart_circ_empty(xmit)) 635 + return; 637 636 638 637 xmit_size = CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE); 639 638 ··· 1069 1070 static void qcom_geni_serial_shutdown(struct uart_port *uport) 1070 1071 { 1071 1072 disable_irq(uport->irq); 1073 + 1074 + if (uart_console(uport)) 1075 + return; 1076 + 1072 1077 qcom_geni_serial_stop_tx(uport); 1073 1078 qcom_geni_serial_stop_rx(uport); 1074 1079 }
+3
drivers/tty/vt/vt.c
··· 4545 4545 int c; 4546 4546 unsigned int vpitch = op->op == KD_FONT_OP_GET_TALL ? op->height : 32; 4547 4547 4548 + if (vpitch > max_font_height) 4549 + return -EINVAL; 4550 + 4548 4551 if (op->data) { 4549 4552 font.data = kvmalloc(max_font_size, GFP_KERNEL); 4550 4553 if (!font.data)
+4 -10
drivers/vfio/pci/mlx5/main.c
··· 442 442 if (migf->pre_copy_initial_bytes > *pos) { 443 443 info.initial_bytes = migf->pre_copy_initial_bytes - *pos; 444 444 } else { 445 - buf = mlx5vf_get_data_buff_from_pos(migf, *pos, &end_of_data); 446 - if (buf) { 447 - info.dirty_bytes = buf->start_pos + buf->length - *pos; 448 - } else { 449 - if (!end_of_data) { 450 - ret = -EINVAL; 451 - goto err_migf_unlock; 452 - } 453 - info.dirty_bytes = inc_length; 454 - } 445 + info.dirty_bytes = migf->max_pos - *pos; 446 + if (!info.dirty_bytes) 447 + end_of_data = true; 448 + info.dirty_bytes += inc_length; 455 449 } 456 450 457 451 if (!end_of_data || !inc_length) {
+1 -1
drivers/video/fbdev/amba-clcd.c
··· 854 854 board->caps = CLCD_CAP_ALL; 855 855 board->check = clcdfb_check; 856 856 board->decode = clcdfb_decode; 857 - if (of_find_property(node, "memory-region", NULL)) { 857 + if (of_property_present(node, "memory-region")) { 858 858 board->setup = clcdfb_of_vram_setup; 859 859 board->mmap = clcdfb_of_vram_mmap; 860 860 board->remove = clcdfb_of_vram_remove;
+3
drivers/video/fbdev/au1200fb.c
··· 1040 1040 u32 pixclock; 1041 1041 int screen_size, plane; 1042 1042 1043 + if (!var->pixclock) 1044 + return -EINVAL; 1045 + 1043 1046 plane = fbdev->plane; 1044 1047 1045 1048 /* Make sure that the mode respect all LCD controller and
+1 -1
drivers/video/fbdev/bw2.c
··· 306 306 if (!par->regs) 307 307 goto out_release_fb; 308 308 309 - if (!of_find_property(dp, "width", NULL)) { 309 + if (!of_property_present(dp, "width")) { 310 310 err = bw2_do_default_mode(par, info, &linebytes); 311 311 if (err) 312 312 goto out_unmap_regs;
+1 -1
drivers/video/fbdev/cg3.c
··· 393 393 394 394 cg3_blank(FB_BLANK_UNBLANK, info); 395 395 396 - if (!of_find_property(dp, "width", NULL)) { 396 + if (!of_property_present(dp, "width")) { 397 397 err = cg3_do_default_mode(par); 398 398 if (err) 399 399 goto out_unmap_screen;
+1 -2
drivers/video/fbdev/clps711x-fb.c
··· 238 238 info->fix.mmio_start = res->start; 239 239 info->fix.mmio_len = resource_size(res); 240 240 241 - res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 242 - info->screen_base = devm_ioremap_resource(dev, res); 241 + info->screen_base = devm_platform_get_and_ioremap_resource(pdev, 1, &res); 243 242 if (IS_ERR(info->screen_base)) { 244 243 ret = PTR_ERR(info->screen_base); 245 244 goto out_fb_release;
+3
drivers/video/fbdev/geode/lxfb_core.c
··· 235 235 236 236 static int lxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) 237 237 { 238 + if (!var->pixclock) 239 + return -EINVAL; 240 + 238 241 if (var->xres > 1920 || var->yres > 1440) 239 242 return -EINVAL; 240 243
+3
drivers/video/fbdev/intelfb/intelfbdrv.c
··· 1222 1222 1223 1223 dinfo = GET_DINFO(info); 1224 1224 1225 + if (!var->pixclock) 1226 + return -EINVAL; 1227 + 1225 1228 /* update the pitch */ 1226 1229 if (intelfbhw_validate_mode(dinfo, var) != 0) 1227 1230 return -EINVAL;
+2
drivers/video/fbdev/nvidia/nvidia.c
··· 764 764 int pitch, err = 0; 765 765 766 766 NVTRACE_ENTER(); 767 + if (!var->pixclock) 768 + return -EINVAL; 767 769 768 770 var->transp.offset = 0; 769 771 var->transp.length = 0;
+2 -2
drivers/video/fbdev/offb.c
··· 549 549 int foreign_endian = 0; 550 550 551 551 #ifdef __BIG_ENDIAN 552 - if (of_get_property(dp, "little-endian", NULL)) 552 + if (of_property_read_bool(dp, "little-endian")) 553 553 foreign_endian = FBINFO_FOREIGN_ENDIAN; 554 554 #else 555 - if (of_get_property(dp, "big-endian", NULL)) 555 + if (of_property_read_bool(dp, "big-endian")) 556 556 foreign_endian = FBINFO_FOREIGN_ENDIAN; 557 557 #endif 558 558
-1
drivers/video/fbdev/omap/Makefile
··· 18 18 19 19 lcds-y$(CONFIG_MACH_AMS_DELTA) += lcd_ams_delta.o 20 20 lcds-y$(CONFIG_MACH_OMAP_PALMTE) += lcd_palmte.o 21 - lcds-y$(CONFIG_MACH_OMAP_OSK) += lcd_osk.o 22 21 23 22 lcds-y$(CONFIG_FB_OMAP_LCD_MIPID) += lcd_mipid.o 24 23
-86
drivers/video/fbdev/omap/lcd_osk.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * LCD panel support for the TI OMAP OSK board 4 - * 5 - * Copyright (C) 2004 Nokia Corporation 6 - * Author: Imre Deak <imre.deak@nokia.com> 7 - * Adapted for OSK by <dirk.behme@de.bosch.com> 8 - */ 9 - 10 - #include <linux/module.h> 11 - #include <linux/platform_device.h> 12 - #include <linux/gpio.h> 13 - 14 - #include <linux/soc/ti/omap1-io.h> 15 - #include <linux/soc/ti/omap1-mux.h> 16 - 17 - #include "omapfb.h" 18 - 19 - static int osk_panel_enable(struct lcd_panel *panel) 20 - { 21 - /* configure PWL pin */ 22 - omap_cfg_reg(PWL); 23 - 24 - /* Enable PWL unit */ 25 - omap_writeb(0x01, OMAP_PWL_CLK_ENABLE); 26 - 27 - /* Set PWL level */ 28 - omap_writeb(0xFF, OMAP_PWL_ENABLE); 29 - 30 - /* set GPIO2 high (lcd power enabled) */ 31 - gpio_set_value(2, 1); 32 - 33 - return 0; 34 - } 35 - 36 - static void osk_panel_disable(struct lcd_panel *panel) 37 - { 38 - /* Set PWL level to zero */ 39 - omap_writeb(0x00, OMAP_PWL_ENABLE); 40 - 41 - /* Disable PWL unit */ 42 - omap_writeb(0x00, OMAP_PWL_CLK_ENABLE); 43 - 44 - /* set GPIO2 low */ 45 - gpio_set_value(2, 0); 46 - } 47 - 48 - static struct lcd_panel osk_panel = { 49 - .name = "osk", 50 - .config = OMAP_LCDC_PANEL_TFT, 51 - 52 - .bpp = 16, 53 - .data_lines = 16, 54 - .x_res = 240, 55 - .y_res = 320, 56 - .pixel_clock = 12500, 57 - .hsw = 40, 58 - .hfp = 40, 59 - .hbp = 72, 60 - .vsw = 1, 61 - .vfp = 1, 62 - .vbp = 0, 63 - .pcd = 12, 64 - 65 - .enable = osk_panel_enable, 66 - .disable = osk_panel_disable, 67 - }; 68 - 69 - static int osk_panel_probe(struct platform_device *pdev) 70 - { 71 - omapfb_register_panel(&osk_panel); 72 - return 0; 73 - } 74 - 75 - static struct platform_driver osk_panel_driver = { 76 - .probe = osk_panel_probe, 77 - .driver = { 78 - .name = "lcd_osk", 79 - }, 80 - }; 81 - 82 - module_platform_driver(osk_panel_driver); 83 - 84 - MODULE_AUTHOR("Imre Deak"); 85 - MODULE_DESCRIPTION("LCD panel support for the TI OMAP OSK board"); 86 - MODULE_LICENSE("GPL");
+18 -12
drivers/video/fbdev/omap/omapfb_main.c
··· 544 544 var->yoffset = var->yres_virtual - var->yres; 545 545 546 546 if (plane->color_mode == OMAPFB_COLOR_RGB444) { 547 - var->red.offset = 8; var->red.length = 4; 548 - var->red.msb_right = 0; 549 - var->green.offset = 4; var->green.length = 4; 550 - var->green.msb_right = 0; 551 - var->blue.offset = 0; var->blue.length = 4; 552 - var->blue.msb_right = 0; 547 + var->red.offset = 8; 548 + var->red.length = 4; 549 + var->red.msb_right = 0; 550 + var->green.offset = 4; 551 + var->green.length = 4; 552 + var->green.msb_right = 0; 553 + var->blue.offset = 0; 554 + var->blue.length = 4; 555 + var->blue.msb_right = 0; 553 556 } else { 554 - var->red.offset = 11; var->red.length = 5; 555 - var->red.msb_right = 0; 556 - var->green.offset = 5; var->green.length = 6; 557 - var->green.msb_right = 0; 558 - var->blue.offset = 0; var->blue.length = 5; 559 - var->blue.msb_right = 0; 557 + var->red.offset = 11; 558 + var->red.length = 5; 559 + var->red.msb_right = 0; 560 + var->green.offset = 5; 561 + var->green.length = 6; 562 + var->green.msb_right = 0; 563 + var->blue.offset = 0; 564 + var->blue.length = 5; 565 + var->blue.msb_right = 0; 560 566 } 561 567 562 568 var->height = -1;
+1 -1
drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c
··· 192 192 omapdss_walk_device(dss, true); 193 193 194 194 for_each_available_child_of_node(dss, child) { 195 - if (!of_find_property(child, "compatible", NULL)) 195 + if (!of_property_present(child, "compatible")) 196 196 continue; 197 197 198 198 omapdss_walk_device(child, true);
+1 -2
drivers/video/fbdev/pxa3xx-gcu.c
··· 599 599 priv->misc_dev.fops = &pxa3xx_gcu_miscdev_fops; 600 600 601 601 /* handle IO resources */ 602 - r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 603 - priv->mmio_base = devm_ioremap_resource(dev, r); 602 + priv->mmio_base = devm_platform_get_and_ioremap_resource(pdev, 0, &r); 604 603 if (IS_ERR(priv->mmio_base)) 605 604 return PTR_ERR(priv->mmio_base); 606 605
+2 -2
drivers/video/fbdev/sm501fb.c
··· 1737 1737 1738 1738 #if defined(CONFIG_OF) 1739 1739 #ifdef __BIG_ENDIAN 1740 - if (of_get_property(info->dev->parent->of_node, "little-endian", NULL)) 1740 + if (of_property_read_bool(info->dev->parent->of_node, "little-endian")) 1741 1741 fb->flags |= FBINFO_FOREIGN_ENDIAN; 1742 1742 #else 1743 - if (of_get_property(info->dev->parent->of_node, "big-endian", NULL)) 1743 + if (of_property_read_bool(info->dev->parent->of_node, "big-endian")) 1744 1744 fb->flags |= FBINFO_FOREIGN_ENDIAN; 1745 1745 #endif 1746 1746 #endif
+27
drivers/video/fbdev/stifb.c
··· 922 922 /* ------------------- driver specific functions --------------------------- */ 923 923 924 924 static int 925 + stifb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) 926 + { 927 + struct stifb_info *fb = container_of(info, struct stifb_info, info); 928 + 929 + if (var->xres != fb->info.var.xres || 930 + var->yres != fb->info.var.yres || 931 + var->bits_per_pixel != fb->info.var.bits_per_pixel) 932 + return -EINVAL; 933 + 934 + var->xres_virtual = var->xres; 935 + var->yres_virtual = var->yres; 936 + var->xoffset = 0; 937 + var->yoffset = 0; 938 + var->grayscale = fb->info.var.grayscale; 939 + var->red.length = fb->info.var.red.length; 940 + var->green.length = fb->info.var.green.length; 941 + var->blue.length = fb->info.var.blue.length; 942 + 943 + return 0; 944 + } 945 + 946 + static int 925 947 stifb_setcolreg(u_int regno, u_int red, u_int green, 926 948 u_int blue, u_int transp, struct fb_info *info) 927 949 { ··· 1167 1145 1168 1146 static const struct fb_ops stifb_ops = { 1169 1147 .owner = THIS_MODULE, 1148 + .fb_check_var = stifb_check_var, 1170 1149 .fb_setcolreg = stifb_setcolreg, 1171 1150 .fb_blank = stifb_blank, 1172 1151 .fb_fillrect = stifb_fillrect, ··· 1187 1164 struct stifb_info *fb; 1188 1165 struct fb_info *info; 1189 1166 unsigned long sti_rom_address; 1167 + char modestr[32]; 1190 1168 char *dev_name; 1191 1169 int bpp, xres, yres; 1192 1170 ··· 1365 1341 info->screen_size = fix->smem_len; 1366 1342 info->flags = FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT; 1367 1343 info->pseudo_palette = &fb->pseudo_palette; 1344 + 1345 + scnprintf(modestr, sizeof(modestr), "%dx%d-%d", xres, yres, bpp); 1346 + fb_find_mode(&info->var, info, modestr, NULL, 0, NULL, bpp); 1368 1347 1369 1348 /* This has to be done !!! */ 1370 1349 if (fb_alloc_cmap(&info->cmap, NR_PALETTE, 0))
+1 -2
drivers/video/fbdev/tcx.c
··· 379 379 380 380 spin_lock_init(&par->lock); 381 381 382 - par->lowdepth = 383 - (of_find_property(dp, "tcx-8-bit", NULL) != NULL); 382 + par->lowdepth = of_property_read_bool(dp, "tcx-8-bit"); 384 383 385 384 sbusfb_fill_var(&info->var, dp, 8); 386 385 info->var.red.length = 8;
+3
drivers/video/fbdev/tgafb.c
··· 173 173 { 174 174 struct tga_par *par = (struct tga_par *)info->par; 175 175 176 + if (!var->pixclock) 177 + return -EINVAL; 178 + 176 179 if (par->tga_type == TGA_TYPE_8PLANE) { 177 180 if (var->bits_per_pixel != 8) 178 181 return -EINVAL;
+1 -3
drivers/video/fbdev/wm8505fb.c
··· 261 261 static int wm8505fb_probe(struct platform_device *pdev) 262 262 { 263 263 struct wm8505fb_info *fbi; 264 - struct resource *res; 265 264 struct display_timings *disp_timing; 266 265 void *addr; 267 266 int ret; ··· 298 299 addr = addr + sizeof(struct wm8505fb_info); 299 300 fbi->fb.pseudo_palette = addr; 300 301 301 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 302 - fbi->regbase = devm_ioremap_resource(&pdev->dev, res); 302 + fbi->regbase = devm_platform_ioremap_resource(pdev, 0); 303 303 if (IS_ERR(fbi->regbase)) 304 304 return PTR_ERR(fbi->regbase); 305 305
+2 -4
drivers/video/fbdev/xilinxfb.c
··· 273 273 if (drvdata->flags & BUS_ACCESS_FLAG) { 274 274 struct resource *res; 275 275 276 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 277 - drvdata->regs = devm_ioremap_resource(&pdev->dev, res); 276 + drvdata->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); 278 277 if (IS_ERR(drvdata->regs)) 279 278 return PTR_ERR(drvdata->regs); 280 279 ··· 468 469 pdata.yvirt = prop[1]; 469 470 } 470 471 471 - if (of_find_property(pdev->dev.of_node, "rotate-display", NULL)) 472 - pdata.rotate_screen = 1; 472 + pdata.rotate_screen = of_property_read_bool(pdev->dev.of_node, "rotate-display"); 473 473 474 474 platform_set_drvdata(pdev, drvdata); 475 475 return xilinxfb_assign(pdev, drvdata, &pdata);
+324 -328
drivers/video/logo/pnmtologo.c
··· 1 - 1 + // SPDX-License-Identifier: GPL-2.0-only 2 2 /* 3 3 * Convert a logo in ASCII PNM format to C source suitable for inclusion in 4 4 * the Linux kernel 5 5 * 6 6 * (C) Copyright 2001-2003 by Geert Uytterhoeven <geert@linux-m68k.org> 7 - * 8 - * -------------------------------------------------------------------------- 9 - * 10 - * This file is subject to the terms and conditions of the GNU General Public 11 - * License. See the file COPYING in the main directory of the Linux 12 - * distribution for more details. 13 7 */ 14 8 15 9 #include <ctype.h> ··· 28 34 #define LINUX_LOGO_GRAY256 4 /* 256 levels grayscale */ 29 35 30 36 static const char *logo_types[LINUX_LOGO_GRAY256+1] = { 31 - [LINUX_LOGO_MONO] = "LINUX_LOGO_MONO", 32 - [LINUX_LOGO_VGA16] = "LINUX_LOGO_VGA16", 33 - [LINUX_LOGO_CLUT224] = "LINUX_LOGO_CLUT224", 34 - [LINUX_LOGO_GRAY256] = "LINUX_LOGO_GRAY256" 37 + [LINUX_LOGO_MONO] = "LINUX_LOGO_MONO", 38 + [LINUX_LOGO_VGA16] = "LINUX_LOGO_VGA16", 39 + [LINUX_LOGO_CLUT224] = "LINUX_LOGO_CLUT224", 40 + [LINUX_LOGO_GRAY256] = "LINUX_LOGO_GRAY256" 35 41 }; 36 42 37 43 #define MAX_LINUX_LOGO_COLORS 224 38 44 39 45 struct color { 40 - unsigned char red; 41 - unsigned char green; 42 - unsigned char blue; 46 + unsigned char red; 47 + unsigned char green; 48 + unsigned char blue; 43 49 }; 44 50 45 51 static const struct color clut_vga16[16] = { 46 - { 0x00, 0x00, 0x00 }, 47 - { 0x00, 0x00, 0xaa }, 48 - { 0x00, 0xaa, 0x00 }, 49 - { 0x00, 0xaa, 0xaa }, 50 - { 0xaa, 0x00, 0x00 }, 51 - { 0xaa, 0x00, 0xaa }, 52 - { 0xaa, 0x55, 0x00 }, 53 - { 0xaa, 0xaa, 0xaa }, 54 - { 0x55, 0x55, 0x55 }, 55 - { 0x55, 0x55, 0xff }, 56 - { 0x55, 0xff, 0x55 }, 57 - { 0x55, 0xff, 0xff }, 58 - { 0xff, 0x55, 0x55 }, 59 - { 0xff, 0x55, 0xff }, 60 - { 0xff, 0xff, 0x55 }, 61 - { 0xff, 0xff, 0xff }, 52 + { 0x00, 0x00, 0x00 }, 53 + { 0x00, 0x00, 0xaa }, 54 + { 0x00, 0xaa, 0x00 }, 55 + { 0x00, 0xaa, 0xaa }, 56 + { 0xaa, 0x00, 0x00 }, 57 + { 0xaa, 0x00, 0xaa }, 58 + { 0xaa, 0x55, 0x00 }, 59 + { 0xaa, 0xaa, 0xaa }, 60 + { 0x55, 0x55, 0x55 }, 61 + { 0x55, 0x55, 0xff }, 62 + { 0x55, 0xff, 0x55 }, 63 + { 0x55, 0xff, 0xff }, 64 + { 0xff, 0x55, 0x55 }, 65 + { 0xff, 0x55, 0xff }, 66 + { 0xff, 0xff, 0x55 }, 67 + { 0xff, 0xff, 0xff }, 62 68 }; 63 69 64 70 ··· 71 77 static int is_plain_pbm = 0; 72 78 73 79 static void die(const char *fmt, ...) 74 - __attribute__ ((noreturn)) __attribute ((format (printf, 1, 2))); 75 - static void usage(void) __attribute ((noreturn)); 80 + __attribute__((noreturn)) __attribute((format (printf, 1, 2))); 81 + static void usage(void) __attribute((noreturn)); 76 82 77 83 78 84 static unsigned int get_number(FILE *fp) 79 85 { 80 - int c, val; 86 + int c, val; 81 87 82 - /* Skip leading whitespace */ 83 - do { 84 - c = fgetc(fp); 85 - if (c == EOF) 86 - die("%s: end of file\n", filename); 87 - if (c == '#') { 88 - /* Ignore comments 'till end of line */ 89 - do { 88 + /* Skip leading whitespace */ 89 + do { 90 90 c = fgetc(fp); 91 91 if (c == EOF) 92 - die("%s: end of file\n", filename); 93 - } while (c != '\n'); 94 - } 95 - } while (isspace(c)); 92 + die("%s: end of file\n", filename); 93 + if (c == '#') { 94 + /* Ignore comments 'till end of line */ 95 + do { 96 + c = fgetc(fp); 97 + if (c == EOF) 98 + die("%s: end of file\n", filename); 99 + } while (c != '\n'); 100 + } 101 + } while (isspace(c)); 96 102 97 - /* Parse decimal number */ 98 - val = 0; 99 - while (isdigit(c)) { 100 - val = 10*val+c-'0'; 101 - /* some PBM are 'broken'; GiMP for example exports a PBM without space 102 - * between the digits. This is Ok cause we know a PBM can only have a '1' 103 - * or a '0' for the digit. */ 104 - if (is_plain_pbm) 105 - break; 106 - c = fgetc(fp); 107 - if (c == EOF) 108 - die("%s: end of file\n", filename); 109 - } 110 - return val; 103 + /* Parse decimal number */ 104 + val = 0; 105 + while (isdigit(c)) { 106 + val = 10*val+c-'0'; 107 + /* some PBM are 'broken'; GiMP for example exports a PBM without space 108 + * between the digits. This is Ok cause we know a PBM can only have a '1' 109 + * or a '0' for the digit. 110 + */ 111 + if (is_plain_pbm) 112 + break; 113 + c = fgetc(fp); 114 + if (c == EOF) 115 + die("%s: end of file\n", filename); 116 + } 117 + return val; 111 118 } 112 119 113 120 static unsigned int get_number255(FILE *fp, unsigned int maxval) 114 121 { 115 - unsigned int val = get_number(fp); 116 - return (255*val+maxval/2)/maxval; 122 + unsigned int val = get_number(fp); 123 + 124 + return (255*val+maxval/2)/maxval; 117 125 } 118 126 119 127 static void read_image(void) 120 128 { 121 - FILE *fp; 122 - unsigned int i, j; 123 - int magic; 124 - unsigned int maxval; 129 + FILE *fp; 130 + unsigned int i, j; 131 + int magic; 132 + unsigned int maxval; 125 133 126 - /* open image file */ 127 - fp = fopen(filename, "r"); 128 - if (!fp) 129 - die("Cannot open file %s: %s\n", filename, strerror(errno)); 134 + /* open image file */ 135 + fp = fopen(filename, "r"); 136 + if (!fp) 137 + die("Cannot open file %s: %s\n", filename, strerror(errno)); 130 138 131 - /* check file type and read file header */ 132 - magic = fgetc(fp); 133 - if (magic != 'P') 134 - die("%s is not a PNM file\n", filename); 135 - magic = fgetc(fp); 136 - switch (magic) { 139 + /* check file type and read file header */ 140 + magic = fgetc(fp); 141 + if (magic != 'P') 142 + die("%s is not a PNM file\n", filename); 143 + magic = fgetc(fp); 144 + switch (magic) { 137 145 case '1': 138 146 case '2': 139 147 case '3': 140 - /* Plain PBM/PGM/PPM */ 141 - break; 148 + /* Plain PBM/PGM/PPM */ 149 + break; 142 150 143 151 case '4': 144 152 case '5': 145 153 case '6': 146 - /* Binary PBM/PGM/PPM */ 147 - die("%s: Binary PNM is not supported\n" 154 + /* Binary PBM/PGM/PPM */ 155 + die("%s: Binary PNM is not supported\n" 148 156 "Use pnmnoraw(1) to convert it to ASCII PNM\n", filename); 149 157 150 158 default: 151 - die("%s is not a PNM file\n", filename); 152 - } 153 - logo_width = get_number(fp); 154 - logo_height = get_number(fp); 159 + die("%s is not a PNM file\n", filename); 160 + } 161 + logo_width = get_number(fp); 162 + logo_height = get_number(fp); 155 163 156 - /* allocate image data */ 157 - logo_data = (struct color **)malloc(logo_height*sizeof(struct color *)); 158 - if (!logo_data) 159 - die("%s\n", strerror(errno)); 160 - for (i = 0; i < logo_height; i++) { 161 - logo_data[i] = malloc(logo_width*sizeof(struct color)); 164 + /* allocate image data */ 165 + logo_data = (struct color **)malloc(logo_height*sizeof(struct color *)); 166 + if (!logo_data) 167 + die("%s\n", strerror(errno)); 168 + for (i = 0; i < logo_height; i++) { 169 + logo_data[i] = malloc(logo_width*sizeof(struct color)); 162 170 if (!logo_data[i]) 163 - die("%s\n", strerror(errno)); 164 - } 171 + die("%s\n", strerror(errno)); 172 + } 165 173 166 - /* read image data */ 167 - switch (magic) { 174 + /* read image data */ 175 + switch (magic) { 168 176 case '1': 169 - /* Plain PBM */ 170 - is_plain_pbm = 1; 171 - for (i = 0; i < logo_height; i++) 172 - for (j = 0; j < logo_width; j++) 173 - logo_data[i][j].red = logo_data[i][j].green = 174 - logo_data[i][j].blue = 255*(1-get_number(fp)); 175 - break; 177 + /* Plain PBM */ 178 + is_plain_pbm = 1; 179 + for (i = 0; i < logo_height; i++) 180 + for (j = 0; j < logo_width; j++) 181 + logo_data[i][j].red = logo_data[i][j].green = 182 + logo_data[i][j].blue = 255*(1-get_number(fp)); 183 + break; 176 184 177 185 case '2': 178 - /* Plain PGM */ 179 - maxval = get_number(fp); 180 - for (i = 0; i < logo_height; i++) 181 - for (j = 0; j < logo_width; j++) 182 - logo_data[i][j].red = logo_data[i][j].green = 183 - logo_data[i][j].blue = get_number255(fp, maxval); 184 - break; 186 + /* Plain PGM */ 187 + maxval = get_number(fp); 188 + for (i = 0; i < logo_height; i++) 189 + for (j = 0; j < logo_width; j++) 190 + logo_data[i][j].red = logo_data[i][j].green = 191 + logo_data[i][j].blue = get_number255(fp, maxval); 192 + break; 185 193 186 194 case '3': 187 - /* Plain PPM */ 188 - maxval = get_number(fp); 189 - for (i = 0; i < logo_height; i++) 190 - for (j = 0; j < logo_width; j++) { 191 - logo_data[i][j].red = get_number255(fp, maxval); 192 - logo_data[i][j].green = get_number255(fp, maxval); 193 - logo_data[i][j].blue = get_number255(fp, maxval); 194 - } 195 - break; 196 - } 195 + /* Plain PPM */ 196 + maxval = get_number(fp); 197 + for (i = 0; i < logo_height; i++) 198 + for (j = 0; j < logo_width; j++) { 199 + logo_data[i][j].red = get_number255(fp, maxval); 200 + logo_data[i][j].green = get_number255(fp, maxval); 201 + logo_data[i][j].blue = get_number255(fp, maxval); 202 + } 203 + break; 204 + } 197 205 198 - /* close file */ 199 - fclose(fp); 206 + /* close file */ 207 + fclose(fp); 200 208 } 201 209 202 210 static inline int is_black(struct color c) 203 211 { 204 - return c.red == 0 && c.green == 0 && c.blue == 0; 212 + return c.red == 0 && c.green == 0 && c.blue == 0; 205 213 } 206 214 207 215 static inline int is_white(struct color c) 208 216 { 209 - return c.red == 255 && c.green == 255 && c.blue == 255; 217 + return c.red == 255 && c.green == 255 && c.blue == 255; 210 218 } 211 219 212 220 static inline int is_gray(struct color c) 213 221 { 214 - return c.red == c.green && c.red == c.blue; 222 + return c.red == c.green && c.red == c.blue; 215 223 } 216 224 217 225 static inline int is_equal(struct color c1, struct color c2) 218 226 { 219 - return c1.red == c2.red && c1.green == c2.green && c1.blue == c2.blue; 227 + return c1.red == c2.red && c1.green == c2.green && c1.blue == c2.blue; 220 228 } 221 229 222 230 static void write_header(void) 223 231 { 224 - /* open logo file */ 225 - if (outputname) { 226 - out = fopen(outputname, "w"); 227 - if (!out) 228 - die("Cannot create file %s: %s\n", outputname, strerror(errno)); 229 - } else { 230 - out = stdout; 231 - } 232 + /* open logo file */ 233 + if (outputname) { 234 + out = fopen(outputname, "w"); 235 + if (!out) 236 + die("Cannot create file %s: %s\n", outputname, strerror(errno)); 237 + } else { 238 + out = stdout; 239 + } 232 240 233 - fputs("/*\n", out); 234 - fputs(" * DO NOT EDIT THIS FILE!\n", out); 235 - fputs(" *\n", out); 236 - fprintf(out, " * It was automatically generated from %s\n", filename); 237 - fputs(" *\n", out); 238 - fprintf(out, " * Linux logo %s\n", logoname); 239 - fputs(" */\n\n", out); 240 - fputs("#include <linux/linux_logo.h>\n\n", out); 241 - fprintf(out, "static unsigned char %s_data[] __initdata = {\n", 242 - logoname); 241 + fputs("/*\n", out); 242 + fputs(" * DO NOT EDIT THIS FILE!\n", out); 243 + fputs(" *\n", out); 244 + fprintf(out, " * It was automatically generated from %s\n", filename); 245 + fputs(" *\n", out); 246 + fprintf(out, " * Linux logo %s\n", logoname); 247 + fputs(" */\n\n", out); 248 + fputs("#include <linux/linux_logo.h>\n\n", out); 249 + fprintf(out, "static unsigned char %s_data[] __initdata = {\n", 250 + logoname); 243 251 } 244 252 245 253 static void write_footer(void) 246 254 { 247 - fputs("\n};\n\n", out); 248 - fprintf(out, "const struct linux_logo %s __initconst = {\n", logoname); 249 - fprintf(out, "\t.type\t\t= %s,\n", logo_types[logo_type]); 250 - fprintf(out, "\t.width\t\t= %d,\n", logo_width); 251 - fprintf(out, "\t.height\t\t= %d,\n", logo_height); 252 - if (logo_type == LINUX_LOGO_CLUT224) { 253 - fprintf(out, "\t.clutsize\t= %d,\n", logo_clutsize); 254 - fprintf(out, "\t.clut\t\t= %s_clut,\n", logoname); 255 - } 256 - fprintf(out, "\t.data\t\t= %s_data\n", logoname); 257 - fputs("};\n\n", out); 255 + fputs("\n};\n\n", out); 256 + fprintf(out, "const struct linux_logo %s __initconst = {\n", logoname); 257 + fprintf(out, "\t.type\t\t= %s,\n", logo_types[logo_type]); 258 + fprintf(out, "\t.width\t\t= %d,\n", logo_width); 259 + fprintf(out, "\t.height\t\t= %d,\n", logo_height); 260 + if (logo_type == LINUX_LOGO_CLUT224) { 261 + fprintf(out, "\t.clutsize\t= %d,\n", logo_clutsize); 262 + fprintf(out, "\t.clut\t\t= %s_clut,\n", logoname); 263 + } 264 + fprintf(out, "\t.data\t\t= %s_data\n", logoname); 265 + fputs("};\n\n", out); 258 266 259 - /* close logo file */ 260 - if (outputname) 261 - fclose(out); 267 + /* close logo file */ 268 + if (outputname) 269 + fclose(out); 262 270 } 263 271 264 272 static int write_hex_cnt; 265 273 266 274 static void write_hex(unsigned char byte) 267 275 { 268 - if (write_hex_cnt % 12) 269 - fprintf(out, ", 0x%02x", byte); 270 - else if (write_hex_cnt) 271 - fprintf(out, ",\n\t0x%02x", byte); 272 - else 273 - fprintf(out, "\t0x%02x", byte); 274 - write_hex_cnt++; 276 + if (write_hex_cnt % 12) 277 + fprintf(out, ", 0x%02x", byte); 278 + else if (write_hex_cnt) 279 + fprintf(out, ",\n\t0x%02x", byte); 280 + else 281 + fprintf(out, "\t0x%02x", byte); 282 + write_hex_cnt++; 275 283 } 276 284 277 285 static void write_logo_mono(void) 278 286 { 279 - unsigned int i, j; 280 - unsigned char val, bit; 287 + unsigned int i, j; 288 + unsigned char val, bit; 281 289 282 - /* validate image */ 283 - for (i = 0; i < logo_height; i++) 284 - for (j = 0; j < logo_width; j++) 285 - if (!is_black(logo_data[i][j]) && !is_white(logo_data[i][j])) 286 - die("Image must be monochrome\n"); 290 + /* validate image */ 291 + for (i = 0; i < logo_height; i++) 292 + for (j = 0; j < logo_width; j++) 293 + if (!is_black(logo_data[i][j]) && !is_white(logo_data[i][j])) 294 + die("Image must be monochrome\n"); 287 295 288 - /* write file header */ 289 - write_header(); 296 + /* write file header */ 297 + write_header(); 290 298 291 - /* write logo data */ 292 - for (i = 0; i < logo_height; i++) { 293 - for (j = 0; j < logo_width;) { 294 - for (val = 0, bit = 0x80; bit && j < logo_width; j++, bit >>= 1) 295 - if (logo_data[i][j].red) 296 - val |= bit; 297 - write_hex(val); 299 + /* write logo data */ 300 + for (i = 0; i < logo_height; i++) { 301 + for (j = 0; j < logo_width;) { 302 + for (val = 0, bit = 0x80; bit && j < logo_width; j++, bit >>= 1) 303 + if (logo_data[i][j].red) 304 + val |= bit; 305 + write_hex(val); 306 + } 298 307 } 299 - } 300 308 301 - /* write logo structure and file footer */ 302 - write_footer(); 309 + /* write logo structure and file footer */ 310 + write_footer(); 303 311 } 304 312 305 313 static void write_logo_vga16(void) 306 314 { 307 - unsigned int i, j, k; 308 - unsigned char val; 315 + unsigned int i, j, k; 316 + unsigned char val; 309 317 310 - /* validate image */ 311 - for (i = 0; i < logo_height; i++) 312 - for (j = 0; j < logo_width; j++) { 313 - for (k = 0; k < 16; k++) 314 - if (is_equal(logo_data[i][j], clut_vga16[k])) 315 - break; 316 - if (k == 16) 317 - die("Image must use the 16 console colors only\n" 318 - "Use ppmquant(1) -map clut_vga16.ppm to reduce the number " 319 - "of colors\n"); 320 - } 318 + /* validate image */ 319 + for (i = 0; i < logo_height; i++) 320 + for (j = 0; j < logo_width; j++) { 321 + for (k = 0; k < 16; k++) 322 + if (is_equal(logo_data[i][j], clut_vga16[k])) 323 + break; 324 + if (k == 16) 325 + die("Image must use the 16 console colors only\n" 326 + "Use ppmquant(1) -map clut_vga16.ppm to reduce the number " 327 + "of colors\n"); 328 + } 321 329 322 - /* write file header */ 323 - write_header(); 330 + /* write file header */ 331 + write_header(); 324 332 325 - /* write logo data */ 326 - for (i = 0; i < logo_height; i++) 327 - for (j = 0; j < logo_width; j++) { 328 - for (k = 0; k < 16; k++) 329 - if (is_equal(logo_data[i][j], clut_vga16[k])) 330 - break; 331 - val = k<<4; 332 - if (++j < logo_width) { 333 - for (k = 0; k < 16; k++) 334 - if (is_equal(logo_data[i][j], clut_vga16[k])) 335 - break; 336 - val |= k; 337 - } 338 - write_hex(val); 339 - } 333 + /* write logo data */ 334 + for (i = 0; i < logo_height; i++) 335 + for (j = 0; j < logo_width; j++) { 336 + for (k = 0; k < 16; k++) 337 + if (is_equal(logo_data[i][j], clut_vga16[k])) 338 + break; 339 + val = k<<4; 340 + if (++j < logo_width) { 341 + for (k = 0; k < 16; k++) 342 + if (is_equal(logo_data[i][j], clut_vga16[k])) 343 + break; 344 + val |= k; 345 + } 346 + write_hex(val); 347 + } 340 348 341 - /* write logo structure and file footer */ 342 - write_footer(); 349 + /* write logo structure and file footer */ 350 + write_footer(); 343 351 } 344 352 345 353 static void write_logo_clut224(void) 346 354 { 347 - unsigned int i, j, k; 355 + unsigned int i, j, k; 348 356 349 - /* validate image */ 350 - for (i = 0; i < logo_height; i++) 351 - for (j = 0; j < logo_width; j++) { 352 - for (k = 0; k < logo_clutsize; k++) 353 - if (is_equal(logo_data[i][j], logo_clut[k])) 354 - break; 355 - if (k == logo_clutsize) { 356 - if (logo_clutsize == MAX_LINUX_LOGO_COLORS) 357 - die("Image has more than %d colors\n" 358 - "Use ppmquant(1) to reduce the number of colors\n", 359 - MAX_LINUX_LOGO_COLORS); 360 - logo_clut[logo_clutsize++] = logo_data[i][j]; 361 - } 357 + /* validate image */ 358 + for (i = 0; i < logo_height; i++) 359 + for (j = 0; j < logo_width; j++) { 360 + for (k = 0; k < logo_clutsize; k++) 361 + if (is_equal(logo_data[i][j], logo_clut[k])) 362 + break; 363 + if (k == logo_clutsize) { 364 + if (logo_clutsize == MAX_LINUX_LOGO_COLORS) 365 + die("Image has more than %d colors\n" 366 + "Use ppmquant(1) to reduce the number of colors\n", 367 + MAX_LINUX_LOGO_COLORS); 368 + logo_clut[logo_clutsize++] = logo_data[i][j]; 369 + } 370 + } 371 + 372 + /* write file header */ 373 + write_header(); 374 + 375 + /* write logo data */ 376 + for (i = 0; i < logo_height; i++) 377 + for (j = 0; j < logo_width; j++) { 378 + for (k = 0; k < logo_clutsize; k++) 379 + if (is_equal(logo_data[i][j], logo_clut[k])) 380 + break; 381 + write_hex(k+32); 382 + } 383 + fputs("\n};\n\n", out); 384 + 385 + /* write logo clut */ 386 + fprintf(out, "static unsigned char %s_clut[] __initdata = {\n", 387 + logoname); 388 + write_hex_cnt = 0; 389 + for (i = 0; i < logo_clutsize; i++) { 390 + write_hex(logo_clut[i].red); 391 + write_hex(logo_clut[i].green); 392 + write_hex(logo_clut[i].blue); 362 393 } 363 394 364 - /* write file header */ 365 - write_header(); 366 - 367 - /* write logo data */ 368 - for (i = 0; i < logo_height; i++) 369 - for (j = 0; j < logo_width; j++) { 370 - for (k = 0; k < logo_clutsize; k++) 371 - if (is_equal(logo_data[i][j], logo_clut[k])) 372 - break; 373 - write_hex(k+32); 374 - } 375 - fputs("\n};\n\n", out); 376 - 377 - /* write logo clut */ 378 - fprintf(out, "static unsigned char %s_clut[] __initdata = {\n", 379 - logoname); 380 - write_hex_cnt = 0; 381 - for (i = 0; i < logo_clutsize; i++) { 382 - write_hex(logo_clut[i].red); 383 - write_hex(logo_clut[i].green); 384 - write_hex(logo_clut[i].blue); 385 - } 386 - 387 - /* write logo structure and file footer */ 388 - write_footer(); 395 + /* write logo structure and file footer */ 396 + write_footer(); 389 397 } 390 398 391 399 static void write_logo_gray256(void) 392 400 { 393 - unsigned int i, j; 401 + unsigned int i, j; 394 402 395 - /* validate image */ 396 - for (i = 0; i < logo_height; i++) 397 - for (j = 0; j < logo_width; j++) 398 - if (!is_gray(logo_data[i][j])) 399 - die("Image must be grayscale\n"); 403 + /* validate image */ 404 + for (i = 0; i < logo_height; i++) 405 + for (j = 0; j < logo_width; j++) 406 + if (!is_gray(logo_data[i][j])) 407 + die("Image must be grayscale\n"); 400 408 401 - /* write file header */ 402 - write_header(); 409 + /* write file header */ 410 + write_header(); 403 411 404 - /* write logo data */ 405 - for (i = 0; i < logo_height; i++) 406 - for (j = 0; j < logo_width; j++) 407 - write_hex(logo_data[i][j].red); 412 + /* write logo data */ 413 + for (i = 0; i < logo_height; i++) 414 + for (j = 0; j < logo_width; j++) 415 + write_hex(logo_data[i][j].red); 408 416 409 - /* write logo structure and file footer */ 410 - write_footer(); 417 + /* write logo structure and file footer */ 418 + write_footer(); 411 419 } 412 420 413 421 static void die(const char *fmt, ...) 414 422 { 415 - va_list ap; 423 + va_list ap; 416 424 417 - va_start(ap, fmt); 418 - vfprintf(stderr, fmt, ap); 419 - va_end(ap); 425 + va_start(ap, fmt); 426 + vfprintf(stderr, fmt, ap); 427 + va_end(ap); 420 428 421 - exit(1); 429 + exit(1); 422 430 } 423 431 424 432 static void usage(void) 425 433 { 426 - die("\n" 434 + die("\n" 427 435 "Usage: %s [options] <filename>\n" 428 436 "\n" 429 437 "Valid options:\n" 430 - " -h : display this usage information\n" 431 - " -n <name> : specify logo name (default: linux_logo)\n" 432 - " -o <output> : output to file <output> instead of stdout\n" 433 - " -t <type> : specify logo type, one of\n" 434 - " mono : monochrome black/white\n" 435 - " vga16 : 16 colors VGA text palette\n" 436 - " clut224 : 224 colors (default)\n" 437 - " gray256 : 256 levels grayscale\n" 438 + " -h : display this usage information\n" 439 + " -n <name> : specify logo name (default: linux_logo)\n" 440 + " -o <output> : output to file <output> instead of stdout\n" 441 + " -t <type> : specify logo type, one of\n" 442 + " mono : monochrome black/white\n" 443 + " vga16 : 16 colors VGA text palette\n" 444 + " clut224 : 224 colors (default)\n" 445 + " gray256 : 256 levels grayscale\n" 438 446 "\n", programname); 439 447 } 440 448 441 449 int main(int argc, char *argv[]) 442 450 { 443 - int opt; 451 + int opt; 444 452 445 - programname = argv[0]; 453 + programname = argv[0]; 446 454 447 - opterr = 0; 448 - while (1) { 449 - opt = getopt(argc, argv, "hn:o:t:"); 450 - if (opt == -1) 451 - break; 455 + opterr = 0; 456 + while (1) { 457 + opt = getopt(argc, argv, "hn:o:t:"); 458 + if (opt == -1) 459 + break; 452 460 453 - switch (opt) { 454 - case 'h': 455 - usage(); 456 - break; 461 + switch (opt) { 462 + case 'h': 463 + usage(); 464 + break; 457 465 458 - case 'n': 459 - logoname = optarg; 460 - break; 466 + case 'n': 467 + logoname = optarg; 468 + break; 461 469 462 - case 'o': 463 - outputname = optarg; 464 - break; 470 + case 'o': 471 + outputname = optarg; 472 + break; 465 473 466 - case 't': 467 - if (!strcmp(optarg, "mono")) 468 - logo_type = LINUX_LOGO_MONO; 469 - else if (!strcmp(optarg, "vga16")) 470 - logo_type = LINUX_LOGO_VGA16; 471 - else if (!strcmp(optarg, "clut224")) 472 - logo_type = LINUX_LOGO_CLUT224; 473 - else if (!strcmp(optarg, "gray256")) 474 - logo_type = LINUX_LOGO_GRAY256; 475 - else 476 - usage(); 477 - break; 474 + case 't': 475 + if (!strcmp(optarg, "mono")) 476 + logo_type = LINUX_LOGO_MONO; 477 + else if (!strcmp(optarg, "vga16")) 478 + logo_type = LINUX_LOGO_VGA16; 479 + else if (!strcmp(optarg, "clut224")) 480 + logo_type = LINUX_LOGO_CLUT224; 481 + else if (!strcmp(optarg, "gray256")) 482 + logo_type = LINUX_LOGO_GRAY256; 483 + else 484 + usage(); 485 + break; 478 486 479 - default: 480 - usage(); 481 - break; 487 + default: 488 + usage(); 489 + break; 490 + } 482 491 } 483 - } 484 - if (optind != argc-1) 485 - usage(); 492 + if (optind != argc-1) 493 + usage(); 486 494 487 - filename = argv[optind]; 495 + filename = argv[optind]; 488 496 489 - read_image(); 490 - switch (logo_type) { 497 + read_image(); 498 + switch (logo_type) { 491 499 case LINUX_LOGO_MONO: 492 - write_logo_mono(); 493 - break; 500 + write_logo_mono(); 501 + break; 494 502 495 503 case LINUX_LOGO_VGA16: 496 - write_logo_vga16(); 497 - break; 504 + write_logo_vga16(); 505 + break; 498 506 499 507 case LINUX_LOGO_CLUT224: 500 - write_logo_clut224(); 501 - break; 508 + write_logo_clut224(); 509 + break; 502 510 503 511 case LINUX_LOGO_GRAY256: 504 - write_logo_gray256(); 505 - break; 506 - } 507 - exit(0); 512 + write_logo_gray256(); 513 + break; 514 + } 515 + exit(0); 508 516 }
+100 -72
drivers/virt/coco/sev-guest/sev-guest.c
··· 31 31 #define AAD_LEN 48 32 32 #define MSG_HDR_VER 1 33 33 34 + #define SNP_REQ_MAX_RETRY_DURATION (60*HZ) 35 + #define SNP_REQ_RETRY_DELAY (2*HZ) 36 + 34 37 struct snp_guest_crypto { 35 38 struct crypto_aead *tfm; 36 39 u8 *iv, *authtag; ··· 321 318 return __enc_payload(snp_dev, req, payload, sz); 322 319 } 323 320 321 + static int __handle_guest_request(struct snp_guest_dev *snp_dev, u64 exit_code, __u64 *fw_err) 322 + { 323 + unsigned long err = 0xff, override_err = 0; 324 + unsigned long req_start = jiffies; 325 + unsigned int override_npages = 0; 326 + int rc; 327 + 328 + retry_request: 329 + /* 330 + * Call firmware to process the request. In this function the encrypted 331 + * message enters shared memory with the host. So after this call the 332 + * sequence number must be incremented or the VMPCK must be deleted to 333 + * prevent reuse of the IV. 334 + */ 335 + rc = snp_issue_guest_request(exit_code, &snp_dev->input, &err); 336 + switch (rc) { 337 + case -ENOSPC: 338 + /* 339 + * If the extended guest request fails due to having too 340 + * small of a certificate data buffer, retry the same 341 + * guest request without the extended data request in 342 + * order to increment the sequence number and thus avoid 343 + * IV reuse. 344 + */ 345 + override_npages = snp_dev->input.data_npages; 346 + exit_code = SVM_VMGEXIT_GUEST_REQUEST; 347 + 348 + /* 349 + * Override the error to inform callers the given extended 350 + * request buffer size was too small and give the caller the 351 + * required buffer size. 352 + */ 353 + override_err = SNP_GUEST_REQ_INVALID_LEN; 354 + 355 + /* 356 + * If this call to the firmware succeeds, the sequence number can 357 + * be incremented allowing for continued use of the VMPCK. If 358 + * there is an error reflected in the return value, this value 359 + * is checked further down and the result will be the deletion 360 + * of the VMPCK and the error code being propagated back to the 361 + * user as an ioctl() return code. 362 + */ 363 + goto retry_request; 364 + 365 + /* 366 + * The host may return SNP_GUEST_REQ_ERR_EBUSY if the request has been 367 + * throttled. Retry in the driver to avoid returning and reusing the 368 + * message sequence number on a different message. 369 + */ 370 + case -EAGAIN: 371 + if (jiffies - req_start > SNP_REQ_MAX_RETRY_DURATION) { 372 + rc = -ETIMEDOUT; 373 + break; 374 + } 375 + schedule_timeout_killable(SNP_REQ_RETRY_DELAY); 376 + goto retry_request; 377 + } 378 + 379 + /* 380 + * Increment the message sequence number. There is no harm in doing 381 + * this now because decryption uses the value stored in the response 382 + * structure and any failure will wipe the VMPCK, preventing further 383 + * use anyway. 384 + */ 385 + snp_inc_msg_seqno(snp_dev); 386 + 387 + if (fw_err) 388 + *fw_err = override_err ?: err; 389 + 390 + if (override_npages) 391 + snp_dev->input.data_npages = override_npages; 392 + 393 + /* 394 + * If an extended guest request was issued and the supplied certificate 395 + * buffer was not large enough, a standard guest request was issued to 396 + * prevent IV reuse. If the standard request was successful, return -EIO 397 + * back to the caller as would have originally been returned. 398 + */ 399 + if (!rc && override_err == SNP_GUEST_REQ_INVALID_LEN) 400 + return -EIO; 401 + 402 + return rc; 403 + } 404 + 324 405 static int handle_guest_request(struct snp_guest_dev *snp_dev, u64 exit_code, int msg_ver, 325 406 u8 type, void *req_buf, size_t req_sz, void *resp_buf, 326 407 u32 resp_sz, __u64 *fw_err) 327 408 { 328 - unsigned long err; 329 409 u64 seqno; 330 410 int rc; 331 411 ··· 424 338 if (rc) 425 339 return rc; 426 340 427 - /* 428 - * Call firmware to process the request. In this function the encrypted 429 - * message enters shared memory with the host. So after this call the 430 - * sequence number must be incremented or the VMPCK must be deleted to 431 - * prevent reuse of the IV. 432 - */ 433 - rc = snp_issue_guest_request(exit_code, &snp_dev->input, &err); 434 - 435 - /* 436 - * If the extended guest request fails due to having too small of a 437 - * certificate data buffer, retry the same guest request without the 438 - * extended data request in order to increment the sequence number 439 - * and thus avoid IV reuse. 440 - */ 441 - if (exit_code == SVM_VMGEXIT_EXT_GUEST_REQUEST && 442 - err == SNP_GUEST_REQ_INVALID_LEN) { 443 - const unsigned int certs_npages = snp_dev->input.data_npages; 444 - 445 - exit_code = SVM_VMGEXIT_GUEST_REQUEST; 446 - 447 - /* 448 - * If this call to the firmware succeeds, the sequence number can 449 - * be incremented allowing for continued use of the VMPCK. If 450 - * there is an error reflected in the return value, this value 451 - * is checked further down and the result will be the deletion 452 - * of the VMPCK and the error code being propagated back to the 453 - * user as an ioctl() return code. 454 - */ 455 - rc = snp_issue_guest_request(exit_code, &snp_dev->input, &err); 456 - 457 - /* 458 - * Override the error to inform callers the given extended 459 - * request buffer size was too small and give the caller the 460 - * required buffer size. 461 - */ 462 - err = SNP_GUEST_REQ_INVALID_LEN; 463 - snp_dev->input.data_npages = certs_npages; 464 - } 465 - 466 - /* 467 - * Increment the message sequence number. There is no harm in doing 468 - * this now because decryption uses the value stored in the response 469 - * structure and any failure will wipe the VMPCK, preventing further 470 - * use anyway. 471 - */ 472 - snp_inc_msg_seqno(snp_dev); 473 - 474 - if (fw_err) 475 - *fw_err = err; 476 - 477 - /* 478 - * If an extended guest request was issued and the supplied certificate 479 - * buffer was not large enough, a standard guest request was issued to 480 - * prevent IV reuse. If the standard request was successful, return -EIO 481 - * back to the caller as would have originally been returned. 482 - */ 483 - if (!rc && err == SNP_GUEST_REQ_INVALID_LEN) 484 - return -EIO; 485 - 341 + rc = __handle_guest_request(snp_dev, exit_code, fw_err); 486 342 if (rc) { 487 - dev_alert(snp_dev->dev, 488 - "Detected error from ASP request. rc: %d, fw_err: %llu\n", 489 - rc, *fw_err); 490 - goto disable_vmpck; 343 + if (rc == -EIO && *fw_err == SNP_GUEST_REQ_INVALID_LEN) 344 + return rc; 345 + 346 + dev_alert(snp_dev->dev, "Detected error from ASP request. rc: %d, fw_err: %llu\n", rc, *fw_err); 347 + snp_disable_vmpck(snp_dev); 348 + return rc; 491 349 } 492 350 493 351 rc = verify_and_dec_payload(snp_dev, resp_buf, resp_sz); 494 352 if (rc) { 495 - dev_alert(snp_dev->dev, 496 - "Detected unexpected decode failure from ASP. rc: %d\n", 497 - rc); 498 - goto disable_vmpck; 353 + dev_alert(snp_dev->dev, "Detected unexpected decode failure from ASP. rc: %d\n", rc); 354 + snp_disable_vmpck(snp_dev); 355 + return rc; 499 356 } 500 357 501 358 return 0; 502 - 503 - disable_vmpck: 504 - snp_disable_vmpck(snp_dev); 505 - return rc; 506 359 } 507 360 508 361 static int get_report(struct snp_guest_dev *snp_dev, struct snp_guest_request_ioctl *arg) ··· 727 702 struct miscdevice *misc; 728 703 void __iomem *mapping; 729 704 int ret; 705 + 706 + if (!cc_platform_has(CC_ATTR_GUEST_SEV_SNP)) 707 + return -ENODEV; 730 708 731 709 if (!dev->platform_data) 732 710 return -ENODEV;
+12 -16
fs/btrfs/block-group.c
··· 1175 1175 < block_group->zone_unusable); 1176 1176 WARN_ON(block_group->space_info->disk_total 1177 1177 < block_group->length * factor); 1178 - WARN_ON(test_bit(BLOCK_GROUP_FLAG_ZONE_IS_ACTIVE, 1179 - &block_group->runtime_flags) && 1180 - block_group->space_info->active_total_bytes 1181 - < block_group->length); 1182 1178 } 1183 1179 block_group->space_info->total_bytes -= block_group->length; 1184 - if (test_bit(BLOCK_GROUP_FLAG_ZONE_IS_ACTIVE, &block_group->runtime_flags)) 1185 - block_group->space_info->active_total_bytes -= block_group->length; 1186 1180 block_group->space_info->bytes_readonly -= 1187 1181 (block_group->length - block_group->zone_unusable); 1188 1182 block_group->space_info->bytes_zone_unusable -= ··· 3470 3476 spin_unlock(&info->delalloc_root_lock); 3471 3477 3472 3478 while (total) { 3479 + struct btrfs_space_info *space_info; 3473 3480 bool reclaim = false; 3474 3481 3475 3482 cache = btrfs_lookup_block_group(info, bytenr); ··· 3478 3483 ret = -ENOENT; 3479 3484 break; 3480 3485 } 3486 + space_info = cache->space_info; 3481 3487 factor = btrfs_bg_type_to_factor(cache->flags); 3482 3488 3483 3489 /* ··· 3493 3497 byte_in_group = bytenr - cache->start; 3494 3498 WARN_ON(byte_in_group > cache->length); 3495 3499 3496 - spin_lock(&cache->space_info->lock); 3500 + spin_lock(&space_info->lock); 3497 3501 spin_lock(&cache->lock); 3498 3502 3499 3503 if (btrfs_test_opt(info, SPACE_CACHE) && ··· 3506 3510 old_val += num_bytes; 3507 3511 cache->used = old_val; 3508 3512 cache->reserved -= num_bytes; 3509 - cache->space_info->bytes_reserved -= num_bytes; 3510 - cache->space_info->bytes_used += num_bytes; 3511 - cache->space_info->disk_used += num_bytes * factor; 3513 + space_info->bytes_reserved -= num_bytes; 3514 + space_info->bytes_used += num_bytes; 3515 + space_info->disk_used += num_bytes * factor; 3512 3516 spin_unlock(&cache->lock); 3513 - spin_unlock(&cache->space_info->lock); 3517 + spin_unlock(&space_info->lock); 3514 3518 } else { 3515 3519 old_val -= num_bytes; 3516 3520 cache->used = old_val; 3517 3521 cache->pinned += num_bytes; 3518 - btrfs_space_info_update_bytes_pinned(info, 3519 - cache->space_info, num_bytes); 3520 - cache->space_info->bytes_used -= num_bytes; 3521 - cache->space_info->disk_used -= num_bytes * factor; 3522 + btrfs_space_info_update_bytes_pinned(info, space_info, 3523 + num_bytes); 3524 + space_info->bytes_used -= num_bytes; 3525 + space_info->disk_used -= num_bytes * factor; 3522 3526 3523 3527 reclaim = should_reclaim_block_group(cache, num_bytes); 3524 3528 3525 3529 spin_unlock(&cache->lock); 3526 - spin_unlock(&cache->space_info->lock); 3530 + spin_unlock(&space_info->lock); 3527 3531 3528 3532 set_extent_dirty(&trans->transaction->pinned_extents, 3529 3533 bytenr, bytenr + num_bytes - 1,
+7 -1
fs/btrfs/free-space-cache.c
··· 2693 2693 bg_reclaim_threshold = READ_ONCE(sinfo->bg_reclaim_threshold); 2694 2694 2695 2695 spin_lock(&ctl->tree_lock); 2696 + /* Count initial region as zone_unusable until it gets activated. */ 2696 2697 if (!used) 2697 2698 to_free = size; 2699 + else if (initial && 2700 + test_bit(BTRFS_FS_ACTIVE_ZONE_TRACKING, &block_group->fs_info->flags) && 2701 + (block_group->flags & (BTRFS_BLOCK_GROUP_METADATA | BTRFS_BLOCK_GROUP_SYSTEM))) 2702 + to_free = 0; 2698 2703 else if (initial) 2699 2704 to_free = block_group->zone_capacity; 2700 2705 else if (offset >= block_group->alloc_offset) ··· 2727 2722 reclaimable_unusable = block_group->zone_unusable - 2728 2723 (block_group->length - block_group->zone_capacity); 2729 2724 /* All the region is now unusable. Mark it as unused and reclaim */ 2730 - if (block_group->zone_unusable == block_group->length) { 2725 + if (block_group->zone_unusable == block_group->length && 2726 + block_group->alloc_offset) { 2731 2727 btrfs_mark_bg_unused(block_group); 2732 2728 } else if (bg_reclaim_threshold && 2733 2729 reclaimable_unusable >=
+2 -5
fs/btrfs/fs.h
··· 120 120 /* Indicate that we want to commit the transaction. */ 121 121 BTRFS_FS_NEED_TRANS_COMMIT, 122 122 123 - /* 124 - * Indicate metadata over-commit is disabled. This is set when active 125 - * zone tracking is needed. 126 - */ 127 - BTRFS_FS_NO_OVERCOMMIT, 123 + /* This is set when active zone tracking is needed. */ 124 + BTRFS_FS_ACTIVE_ZONE_TRACKING, 128 125 129 126 /* 130 127 * Indicate if we have some features changed, this is mostly for
+6 -1
fs/btrfs/inode.c
··· 5421 5421 return -ENOMEM; 5422 5422 5423 5423 ret = fscrypt_setup_filename(&dir->vfs_inode, &dentry->d_name, 1, &fname); 5424 - if (ret) 5424 + if (ret < 0) 5425 5425 goto out; 5426 + /* 5427 + * fscrypt_setup_filename() should never return a positive value, but 5428 + * gcc on sparc/parisc thinks it can, so assert that doesn't happen. 5429 + */ 5430 + ASSERT(ret == 0); 5426 5431 5427 5432 /* This needs to handle no-key deletions later on */ 5428 5433
+10 -32
fs/btrfs/space-info.c
··· 308 308 ASSERT(found); 309 309 spin_lock(&found->lock); 310 310 found->total_bytes += block_group->length; 311 - if (test_bit(BLOCK_GROUP_FLAG_ZONE_IS_ACTIVE, &block_group->runtime_flags)) 312 - found->active_total_bytes += block_group->length; 313 311 found->disk_total += block_group->length * factor; 314 312 found->bytes_used += block_group->used; 315 313 found->disk_used += block_group->used * factor; ··· 377 379 return avail; 378 380 } 379 381 380 - static inline u64 writable_total_bytes(struct btrfs_fs_info *fs_info, 381 - struct btrfs_space_info *space_info) 382 - { 383 - /* 384 - * On regular filesystem, all total_bytes are always writable. On zoned 385 - * filesystem, there may be a limitation imposed by max_active_zones. 386 - * For metadata allocation, we cannot finish an existing active block 387 - * group to avoid a deadlock. Thus, we need to consider only the active 388 - * groups to be writable for metadata space. 389 - */ 390 - if (!btrfs_is_zoned(fs_info) || (space_info->flags & BTRFS_BLOCK_GROUP_DATA)) 391 - return space_info->total_bytes; 392 - 393 - return space_info->active_total_bytes; 394 - } 395 - 396 382 int btrfs_can_overcommit(struct btrfs_fs_info *fs_info, 397 383 struct btrfs_space_info *space_info, u64 bytes, 398 384 enum btrfs_reserve_flush_enum flush) ··· 389 407 return 0; 390 408 391 409 used = btrfs_space_info_used(space_info, true); 392 - if (test_bit(BTRFS_FS_NO_OVERCOMMIT, &fs_info->flags) && 410 + if (test_bit(BTRFS_FS_ACTIVE_ZONE_TRACKING, &fs_info->flags) && 393 411 (space_info->flags & BTRFS_BLOCK_GROUP_METADATA)) 394 412 avail = 0; 395 413 else 396 414 avail = calc_available_free_space(fs_info, space_info, flush); 397 415 398 - if (used + bytes < writable_total_bytes(fs_info, space_info) + avail) 416 + if (used + bytes < space_info->total_bytes + avail) 399 417 return 1; 400 418 return 0; 401 419 } ··· 431 449 ticket = list_first_entry(head, struct reserve_ticket, list); 432 450 433 451 /* Check and see if our ticket can be satisfied now. */ 434 - if ((used + ticket->bytes <= writable_total_bytes(fs_info, space_info)) || 452 + if ((used + ticket->bytes <= space_info->total_bytes) || 435 453 btrfs_can_overcommit(fs_info, space_info, ticket->bytes, 436 454 flush)) { 437 455 btrfs_space_info_update_bytes_may_use(fs_info, ··· 811 829 { 812 830 u64 used; 813 831 u64 avail; 814 - u64 total; 815 832 u64 to_reclaim = space_info->reclaim_size; 816 833 817 834 lockdep_assert_held(&space_info->lock); ··· 825 844 * space. If that's the case add in our overage so we make sure to put 826 845 * appropriate pressure on the flushing state machine. 827 846 */ 828 - total = writable_total_bytes(fs_info, space_info); 829 - if (total + avail < used) 830 - to_reclaim += used - (total + avail); 847 + if (space_info->total_bytes + avail < used) 848 + to_reclaim += used - (space_info->total_bytes + avail); 831 849 832 850 return to_reclaim; 833 851 } ··· 836 856 { 837 857 u64 global_rsv_size = fs_info->global_block_rsv.reserved; 838 858 u64 ordered, delalloc; 839 - u64 total = writable_total_bytes(fs_info, space_info); 840 859 u64 thresh; 841 860 u64 used; 842 861 843 - thresh = mult_perc(total, 90); 862 + thresh = mult_perc(space_info->total_bytes, 90); 844 863 845 864 lockdep_assert_held(&space_info->lock); 846 865 ··· 902 923 BTRFS_RESERVE_FLUSH_ALL); 903 924 used = space_info->bytes_used + space_info->bytes_reserved + 904 925 space_info->bytes_readonly + global_rsv_size; 905 - if (used < total) 906 - thresh += total - used; 926 + if (used < space_info->total_bytes) 927 + thresh += space_info->total_bytes - used; 907 928 thresh >>= space_info->clamp; 908 929 909 930 used = space_info->bytes_pinned; ··· 1630 1651 * can_overcommit() to ensure we can overcommit to continue. 1631 1652 */ 1632 1653 if (!pending_tickets && 1633 - ((used + orig_bytes <= writable_total_bytes(fs_info, space_info)) || 1654 + ((used + orig_bytes <= space_info->total_bytes) || 1634 1655 btrfs_can_overcommit(fs_info, space_info, orig_bytes, flush))) { 1635 1656 btrfs_space_info_update_bytes_may_use(fs_info, space_info, 1636 1657 orig_bytes); ··· 1644 1665 */ 1645 1666 if (ret && unlikely(flush == BTRFS_RESERVE_FLUSH_EMERGENCY)) { 1646 1667 used = btrfs_space_info_used(space_info, false); 1647 - if (used + orig_bytes <= 1648 - writable_total_bytes(fs_info, space_info)) { 1668 + if (used + orig_bytes <= space_info->total_bytes) { 1649 1669 btrfs_space_info_update_bytes_may_use(fs_info, space_info, 1650 1670 orig_bytes); 1651 1671 ret = 0;
-2
fs/btrfs/space-info.h
··· 96 96 u64 bytes_may_use; /* number of bytes that may be used for 97 97 delalloc/allocations */ 98 98 u64 bytes_readonly; /* total bytes that are read only */ 99 - /* Total bytes in the space, but only accounts active block groups. */ 100 - u64 active_total_bytes; 101 99 u64 bytes_zone_unusable; /* total bytes that are unusable until 102 100 resetting the device zone */ 103 101
+2 -1
fs/btrfs/volumes.c
··· 6363 6363 ASSERT(op != BTRFS_MAP_DISCARD); 6364 6364 6365 6365 em = btrfs_get_chunk_map(fs_info, logical, *length); 6366 - ASSERT(!IS_ERR(em)); 6366 + if (IS_ERR(em)) 6367 + return PTR_ERR(em); 6367 6368 6368 6369 map = em->map_lookup; 6369 6370 data_stripes = nr_data_stripes(map);
+32 -13
fs/btrfs/zoned.c
··· 524 524 } 525 525 atomic_set(&zone_info->active_zones_left, 526 526 max_active_zones - nactive); 527 - /* Overcommit does not work well with active zone tacking. */ 528 - set_bit(BTRFS_FS_NO_OVERCOMMIT, &fs_info->flags); 527 + set_bit(BTRFS_FS_ACTIVE_ZONE_TRACKING, &fs_info->flags); 529 528 } 530 529 531 530 /* Validate superblock log */ ··· 1580 1581 return; 1581 1582 1582 1583 WARN_ON(cache->bytes_super != 0); 1583 - unusable = (cache->alloc_offset - cache->used) + 1584 - (cache->length - cache->zone_capacity); 1585 - free = cache->zone_capacity - cache->alloc_offset; 1584 + 1585 + /* Check for block groups never get activated */ 1586 + if (test_bit(BTRFS_FS_ACTIVE_ZONE_TRACKING, &cache->fs_info->flags) && 1587 + cache->flags & (BTRFS_BLOCK_GROUP_METADATA | BTRFS_BLOCK_GROUP_SYSTEM) && 1588 + !test_bit(BLOCK_GROUP_FLAG_ZONE_IS_ACTIVE, &cache->runtime_flags) && 1589 + cache->alloc_offset == 0) { 1590 + unusable = cache->length; 1591 + free = 0; 1592 + } else { 1593 + unusable = (cache->alloc_offset - cache->used) + 1594 + (cache->length - cache->zone_capacity); 1595 + free = cache->zone_capacity - cache->alloc_offset; 1596 + } 1586 1597 1587 1598 /* We only need ->free_space in ALLOC_SEQ block groups */ 1588 1599 cache->cached = BTRFS_CACHE_FINISHED; ··· 1911 1902 1912 1903 /* Successfully activated all the zones */ 1913 1904 set_bit(BLOCK_GROUP_FLAG_ZONE_IS_ACTIVE, &block_group->runtime_flags); 1914 - space_info->active_total_bytes += block_group->length; 1905 + WARN_ON(block_group->alloc_offset != 0); 1906 + if (block_group->zone_unusable == block_group->length) { 1907 + block_group->zone_unusable = block_group->length - block_group->zone_capacity; 1908 + space_info->bytes_zone_unusable -= block_group->zone_capacity; 1909 + } 1915 1910 spin_unlock(&block_group->lock); 1916 1911 btrfs_try_granting_tickets(fs_info, space_info); 1917 1912 spin_unlock(&space_info->lock); ··· 2099 2086 if (!device->bdev) 2100 2087 continue; 2101 2088 2102 - if (!zinfo->max_active_zones || 2103 - atomic_read(&zinfo->active_zones_left)) { 2089 + if (!zinfo->max_active_zones) { 2104 2090 ret = true; 2105 2091 break; 2106 2092 } 2093 + 2094 + switch (flags & BTRFS_BLOCK_GROUP_PROFILE_MASK) { 2095 + case 0: /* single */ 2096 + ret = (atomic_read(&zinfo->active_zones_left) >= 1); 2097 + break; 2098 + case BTRFS_BLOCK_GROUP_DUP: 2099 + ret = (atomic_read(&zinfo->active_zones_left) >= 2); 2100 + break; 2101 + } 2102 + if (ret) 2103 + break; 2107 2104 } 2108 2105 mutex_unlock(&fs_info->chunk_mutex); 2109 2106 ··· 2279 2256 u64 avail; 2280 2257 2281 2258 spin_lock(&block_group->lock); 2282 - if (block_group->reserved || 2259 + if (block_group->reserved || block_group->alloc_offset == 0 || 2283 2260 (block_group->flags & BTRFS_BLOCK_GROUP_SYSTEM)) { 2284 2261 spin_unlock(&block_group->lock); 2285 2262 continue; ··· 2314 2291 int index; 2315 2292 2316 2293 if (!btrfs_is_zoned(fs_info) || (space_info->flags & BTRFS_BLOCK_GROUP_DATA)) 2317 - return 0; 2318 - 2319 - /* No more block groups to activate */ 2320 - if (space_info->active_total_bytes == space_info->total_bytes) 2321 2294 return 0; 2322 2295 2323 2296 for (;;) {
+13 -10
fs/crypto/keyring.c
··· 92 92 * destroying any subkeys embedded in it. 93 93 */ 94 94 95 + if (WARN_ON(!sb->s_master_keys)) 96 + return; 95 97 spin_lock(&sb->s_master_keys->lock); 96 98 hlist_del_rcu(&mk->mk_node); 97 99 spin_unlock(&sb->s_master_keys->lock); ··· 209 207 * Release all encryption keys that have been added to the filesystem, along 210 208 * with the keyring that contains them. 211 209 * 212 - * This is called at unmount time. The filesystem's underlying block device(s) 213 - * are still available at this time; this is important because after user file 214 - * accesses have been allowed, this function may need to evict keys from the 215 - * keyslots of an inline crypto engine, which requires the block device(s). 210 + * This is called at unmount time, after all potentially-encrypted inodes have 211 + * been evicted. The filesystem's underlying block device(s) are still 212 + * available at this time; this is important because after user file accesses 213 + * have been allowed, this function may need to evict keys from the keyslots of 214 + * an inline crypto engine, which requires the block device(s). 216 215 */ 217 216 void fscrypt_destroy_keyring(struct super_block *sb) 218 217 { ··· 230 227 231 228 hlist_for_each_entry_safe(mk, tmp, bucket, mk_node) { 232 229 /* 233 - * Since all inodes were already evicted, every key 234 - * remaining in the keyring should have an empty inode 235 - * list, and should only still be in the keyring due to 236 - * the single active ref associated with ->mk_secret. 237 - * There should be no structural refs beyond the one 238 - * associated with the active ref. 230 + * Since all potentially-encrypted inodes were already 231 + * evicted, every key remaining in the keyring should 232 + * have an empty inode list, and should only still be in 233 + * the keyring due to the single active ref associated 234 + * with ->mk_secret. There should be no structural refs 235 + * beyond the one associated with the active ref. 239 236 */ 240 237 WARN_ON(refcount_read(&mk->mk_active_refs) != 1); 241 238 WARN_ON(refcount_read(&mk->mk_struct_refs) != 1);
+1 -3
fs/ext4/namei.c
··· 3884 3884 goto end_rename; 3885 3885 } 3886 3886 retval = ext4_rename_dir_prepare(handle, &old); 3887 - if (retval) { 3888 - inode_unlock(old.inode); 3887 + if (retval) 3889 3888 goto end_rename; 3890 - } 3891 3889 } 3892 3890 /* 3893 3891 * If we're renaming a file within an inline_data dir and adding or
+18
fs/gfs2/dentry.c
··· 83 83 return 0; 84 84 } 85 85 86 + static int gfs2_dentry_delete(const struct dentry *dentry) 87 + { 88 + struct gfs2_inode *ginode; 89 + 90 + if (d_really_is_negative(dentry)) 91 + return 0; 92 + 93 + ginode = GFS2_I(d_inode(dentry)); 94 + if (!gfs2_holder_initialized(&ginode->i_iopen_gh)) 95 + return 0; 96 + 97 + if (test_bit(GLF_DEMOTE, &ginode->i_iopen_gh.gh_gl->gl_flags)) 98 + return 1; 99 + 100 + return 0; 101 + } 102 + 86 103 const struct dentry_operations gfs2_dops = { 87 104 .d_revalidate = gfs2_drevalidate, 88 105 .d_hash = gfs2_dhash, 106 + .d_delete = gfs2_dentry_delete, 89 107 }; 90 108
+1 -8
fs/lockd/clnt4xdr.c
··· 261 261 u32 exclusive; 262 262 int error; 263 263 __be32 *p; 264 - s32 end; 265 264 266 265 memset(lock, 0, sizeof(*lock)); 267 266 locks_init_lock(fl); ··· 284 285 fl->fl_type = exclusive != 0 ? F_WRLCK : F_RDLCK; 285 286 p = xdr_decode_hyper(p, &l_offset); 286 287 xdr_decode_hyper(p, &l_len); 287 - end = l_offset + l_len - 1; 288 - 289 - fl->fl_start = (loff_t)l_offset; 290 - if (l_len == 0 || end < 0) 291 - fl->fl_end = OFFSET_MAX; 292 - else 293 - fl->fl_end = (loff_t)end; 288 + nlm4svc_set_file_lock_range(fl, l_offset, l_len); 294 289 error = 0; 295 290 out: 296 291 return error;
+12 -1
fs/lockd/xdr4.c
··· 33 33 return res; 34 34 } 35 35 36 + void nlm4svc_set_file_lock_range(struct file_lock *fl, u64 off, u64 len) 37 + { 38 + s64 end = off + len - 1; 39 + 40 + fl->fl_start = off; 41 + if (len == 0 || end < 0) 42 + fl->fl_end = OFFSET_MAX; 43 + else 44 + fl->fl_end = end; 45 + } 46 + 36 47 /* 37 48 * NLM file handles are defined by specification to be a variable-length 38 49 * XDR opaque no longer than 1024 bytes. However, this implementation ··· 91 80 locks_init_lock(fl); 92 81 fl->fl_flags = FL_POSIX; 93 82 fl->fl_type = F_RDLCK; 94 - 83 + nlm4svc_set_file_lock_range(fl, lock->lock_start, lock->lock_len); 95 84 return true; 96 85 } 97 86
+1 -1
fs/nfs/Kconfig
··· 75 75 config NFS_V4 76 76 tristate "NFS client support for NFS version 4" 77 77 depends on NFS_FS 78 - select SUNRPC_GSS 78 + select RPCSEC_GSS_KRB5 79 79 select KEYS 80 80 help 81 81 This option enables support for version 4 of the NFS protocol
+1 -1
fs/nfs/dir.c
··· 3089 3089 else 3090 3090 goto found; 3091 3091 } 3092 - set->timestamp = ktime_get_ns(); 3093 3092 rb_link_node(&set->rb_node, parent, p); 3094 3093 rb_insert_color(&set->rb_node, root_node); 3095 3094 list_add_tail(&set->lru, &nfsi->access_cache_entry_lru); ··· 3113 3114 cache->fsgid = cred->fsgid; 3114 3115 cache->group_info = get_group_info(cred->group_info); 3115 3116 cache->mask = set->mask; 3117 + cache->timestamp = ktime_get_ns(); 3116 3118 3117 3119 /* The above field assignments must be visible 3118 3120 * before this item appears on the lru. We cannot easily
+3
fs/nfs/read.c
··· 15 15 #include <linux/stat.h> 16 16 #include <linux/mm.h> 17 17 #include <linux/slab.h> 18 + #include <linux/task_io_accounting_ops.h> 18 19 #include <linux/pagemap.h> 19 20 #include <linux/sunrpc/clnt.h> 20 21 #include <linux/nfs_fs.h> ··· 338 337 339 338 trace_nfs_aop_readpage(inode, folio); 340 339 nfs_inc_stats(inode, NFSIOS_VFSREADPAGE); 340 + task_io_account_read(folio_size(folio)); 341 341 342 342 /* 343 343 * Try to flush any pending writes to the file.. ··· 395 393 396 394 trace_nfs_aop_readahead(inode, readahead_pos(ractl), nr_pages); 397 395 nfs_inc_stats(inode, NFSIOS_VFSREADPAGES); 396 + task_io_account_read(readahead_length(ractl)); 398 397 399 398 ret = -ESTALE; 400 399 if (NFS_STALE(inode))
+1 -1
fs/nfsd/Kconfig
··· 73 73 bool "NFS server support for NFS version 4" 74 74 depends on NFSD && PROC_FS 75 75 select FS_POSIX_ACL 76 - select SUNRPC_GSS 76 + select RPCSEC_GSS_KRB5 77 77 select CRYPTO 78 78 select CRYPTO_MD5 79 79 select CRYPTO_SHA256
+8 -1
fs/nfsd/vfs.c
··· 941 941 struct page *last_page; 942 942 943 943 last_page = page + (offset + sd->len - 1) / PAGE_SIZE; 944 - for (page += offset / PAGE_SIZE; page <= last_page; page++) 944 + for (page += offset / PAGE_SIZE; page <= last_page; page++) { 945 + /* 946 + * Skip page replacement when extending the contents 947 + * of the current page. 948 + */ 949 + if (page == *(rqstp->rq_next_page - 1)) 950 + continue; 945 951 svc_rqst_replace_page(rqstp, page); 952 + } 946 953 if (rqstp->rq_res.page_len == 0) // first call 947 954 rqstp->rq_res.page_base = offset % PAGE_SIZE; 948 955 rqstp->rq_res.page_len += sd->len;
+12 -3
fs/super.c
··· 475 475 476 476 cgroup_writeback_umount(); 477 477 478 - /* evict all inodes with zero refcount */ 478 + /* Evict all inodes with zero refcount. */ 479 479 evict_inodes(sb); 480 - /* only nonzero refcount inodes can have marks */ 480 + 481 + /* 482 + * Clean up and evict any inodes that still have references due 483 + * to fsnotify or the security policy. 484 + */ 481 485 fsnotify_sb_delete(sb); 482 - fscrypt_destroy_keyring(sb); 483 486 security_sb_delete(sb); 487 + 488 + /* 489 + * Now that all potentially-encrypted inodes have been evicted, 490 + * the fscrypt keyring can be destroyed. 491 + */ 492 + fscrypt_destroy_keyring(sb); 484 493 485 494 if (sb->s_dio_done_wq) { 486 495 destroy_workqueue(sb->s_dio_done_wq);
+13 -12
fs/verity/enable.c
··· 8 8 #include "fsverity_private.h" 9 9 10 10 #include <linux/mount.h> 11 - #include <linux/pagemap.h> 12 11 #include <linux/sched/signal.h> 13 12 #include <linux/uaccess.h> 14 13 ··· 366 367 goto out_drop_write; 367 368 368 369 err = enable_verity(filp, &arg); 369 - if (err) 370 - goto out_allow_write_access; 371 370 372 371 /* 373 - * Some pages of the file may have been evicted from pagecache after 374 - * being used in the Merkle tree construction, then read into pagecache 375 - * again by another process reading from the file concurrently. Since 376 - * these pages didn't undergo verification against the file digest which 377 - * fs-verity now claims to be enforcing, we have to wipe the pagecache 378 - * to ensure that all future reads are verified. 372 + * We no longer drop the inode's pagecache after enabling verity. This 373 + * used to be done to try to avoid a race condition where pages could be 374 + * evicted after being used in the Merkle tree construction, then 375 + * re-instantiated by a concurrent read. Such pages are unverified, and 376 + * the backing storage could have filled them with different content, so 377 + * they shouldn't be used to fulfill reads once verity is enabled. 378 + * 379 + * But, dropping the pagecache has a big performance impact, and it 380 + * doesn't fully solve the race condition anyway. So for those reasons, 381 + * and also because this race condition isn't very important relatively 382 + * speaking (especially for small-ish files, where the chance of a page 383 + * being used, evicted, *and* re-instantiated all while enabling verity 384 + * is quite small), we no longer drop the inode's pagecache. 379 385 */ 380 - filemap_write_and_wait(inode->i_mapping); 381 - invalidate_inode_pages2(inode->i_mapping); 382 386 383 387 /* 384 388 * allow_write_access() is needed to pair with deny_write_access(). 385 389 * Regardless, the filesystem won't allow writing to verity files. 386 390 */ 387 - out_allow_write_access: 388 391 allow_write_access(filp); 389 392 out_drop_write: 390 393 mnt_drop_write_file(filp);
+6 -6
fs/verity/verify.c
··· 387 387 int __init fsverity_init_workqueue(void) 388 388 { 389 389 /* 390 - * Use an unbound workqueue to allow bios to be verified in parallel 391 - * even when they happen to complete on the same CPU. This sacrifices 392 - * locality, but it's worthwhile since hashing is CPU-intensive. 390 + * Use a high-priority workqueue to prioritize verification work, which 391 + * blocks reads from completing, over regular application tasks. 393 392 * 394 - * Also use a high-priority workqueue to prioritize verification work, 395 - * which blocks reads from completing, over regular application tasks. 393 + * For performance reasons, don't use an unbound workqueue. Using an 394 + * unbound workqueue for crypto operations causes excessive scheduler 395 + * latency on ARM64. 396 396 */ 397 397 fsverity_read_workqueue = alloc_workqueue("fsverity_read_queue", 398 - WQ_UNBOUND | WQ_HIGHPRI, 398 + WQ_HIGHPRI, 399 399 num_online_cpus()); 400 400 if (!fsverity_read_workqueue) 401 401 return -ENOMEM;
+2 -2
fs/zonefs/file.c
··· 383 383 struct block_device *bdev = inode->i_sb->s_bdev; 384 384 unsigned int max = bdev_max_zone_append_sectors(bdev); 385 385 struct bio *bio; 386 - ssize_t size; 386 + ssize_t size = 0; 387 387 int nr_pages; 388 388 ssize_t ret; 389 389 ··· 426 426 if (bio->bi_iter.bi_sector != wpsector) { 427 427 zonefs_warn(inode->i_sb, 428 428 "Corrupted write pointer %llu for zone at %llu\n", 429 - wpsector, z->z_sector); 429 + bio->bi_iter.bi_sector, z->z_sector); 430 430 ret = -EIO; 431 431 } 432 432 }
+8 -1
include/linux/acpi_mdio.h
··· 9 9 #include <linux/phy.h> 10 10 11 11 #if IS_ENABLED(CONFIG_ACPI_MDIO) 12 - int acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode); 12 + int __acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode, 13 + struct module *owner); 14 + 15 + static inline int 16 + acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *handle) 17 + { 18 + return __acpi_mdiobus_register(mdio, handle, THIS_MODULE); 19 + } 13 20 #else /* CONFIG_ACPI_MDIO */ 14 21 static inline int 15 22 acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode)
+12
include/linux/interconnect-provider.h
··· 122 122 void icc_node_add(struct icc_node *node, struct icc_provider *provider); 123 123 void icc_node_del(struct icc_node *node); 124 124 int icc_nodes_remove(struct icc_provider *provider); 125 + void icc_provider_init(struct icc_provider *provider); 126 + int icc_provider_register(struct icc_provider *provider); 127 + void icc_provider_deregister(struct icc_provider *provider); 125 128 int icc_provider_add(struct icc_provider *provider); 126 129 void icc_provider_del(struct icc_provider *provider); 127 130 struct icc_node_data *of_icc_get_from_provider(struct of_phandle_args *spec); ··· 169 166 { 170 167 return -ENOTSUPP; 171 168 } 169 + 170 + static inline void icc_provider_init(struct icc_provider *provider) { } 171 + 172 + static inline int icc_provider_register(struct icc_provider *provider) 173 + { 174 + return -ENOTSUPP; 175 + } 176 + 177 + static inline void icc_provider_deregister(struct icc_provider *provider) { } 172 178 173 179 static inline int icc_provider_add(struct icc_provider *provider) 174 180 {
+1
include/linux/lockd/xdr4.h
··· 22 22 #define nlm4_fbig cpu_to_be32(NLM_FBIG) 23 23 #define nlm4_failed cpu_to_be32(NLM_FAILED) 24 24 25 + void nlm4svc_set_file_lock_range(struct file_lock *fl, u64 off, u64 len); 25 26 bool nlm4svc_decode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr); 26 27 bool nlm4svc_decode_testargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 27 28 bool nlm4svc_decode_lockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
+19 -3
include/linux/of_mdio.h
··· 14 14 15 15 #if IS_ENABLED(CONFIG_OF_MDIO) 16 16 bool of_mdiobus_child_is_phy(struct device_node *child); 17 - int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np); 18 - int devm_of_mdiobus_register(struct device *dev, struct mii_bus *mdio, 19 - struct device_node *np); 17 + int __of_mdiobus_register(struct mii_bus *mdio, struct device_node *np, 18 + struct module *owner); 19 + 20 + static inline int of_mdiobus_register(struct mii_bus *mdio, 21 + struct device_node *np) 22 + { 23 + return __of_mdiobus_register(mdio, np, THIS_MODULE); 24 + } 25 + 26 + int __devm_of_mdiobus_register(struct device *dev, struct mii_bus *mdio, 27 + struct device_node *np, struct module *owner); 28 + 29 + static inline int devm_of_mdiobus_register(struct device *dev, 30 + struct mii_bus *mdio, 31 + struct device_node *np) 32 + { 33 + return __devm_of_mdiobus_register(dev, mdio, np, THIS_MODULE); 34 + } 35 + 20 36 struct mdio_device *of_mdio_find_device(struct device_node *np); 21 37 struct phy_device *of_phy_find_device(struct device_node *phy_np); 22 38 struct phy_device *
+1 -1
include/linux/stmmac.h
··· 215 215 int unicast_filter_entries; 216 216 int tx_fifo_size; 217 217 int rx_fifo_size; 218 - u32 addr64; 218 + u32 host_dma_width; 219 219 u32 rx_queues_to_use; 220 220 u32 tx_queues_to_use; 221 221 u8 rx_sched_algorithm;
+1
include/net/bluetooth/hci_core.h
··· 1613 1613 void hci_conn_del_sysfs(struct hci_conn *conn); 1614 1614 1615 1615 #define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->dev.parent = (pdev)) 1616 + #define GET_HCIDEV_DEV(hdev) ((hdev)->dev.parent) 1616 1617 1617 1618 /* ----- LMP capabilities ----- */ 1618 1619 #define lmp_encrypt_capable(dev) ((dev)->features[0][0] & LMP_ENCRYPT)
+7 -3
init/main.c
··· 156 156 157 157 #ifdef CONFIG_BOOT_CONFIG 158 158 /* Is bootconfig on command line? */ 159 - static bool bootconfig_found = IS_ENABLED(CONFIG_BOOT_CONFIG_FORCE); 159 + static bool bootconfig_found; 160 160 static size_t initargs_offs; 161 161 #else 162 162 # define bootconfig_found false ··· 429 429 err = parse_args("bootconfig", tmp_cmdline, NULL, 0, 0, 0, NULL, 430 430 bootconfig_params); 431 431 432 - if (IS_ERR(err) || !bootconfig_found) 432 + if (IS_ERR(err) || !(bootconfig_found || IS_ENABLED(CONFIG_BOOT_CONFIG_FORCE))) 433 433 return; 434 434 435 435 /* parse_args() stops at the next param of '--' and returns an address */ ··· 437 437 initargs_offs = err - tmp_cmdline; 438 438 439 439 if (!data) { 440 - pr_err("'bootconfig' found on command line, but no bootconfig found\n"); 440 + /* If user intended to use bootconfig, show an error level message */ 441 + if (bootconfig_found) 442 + pr_err("'bootconfig' found on command line, but no bootconfig found\n"); 443 + else 444 + pr_info("No bootconfig data provided, so skipping bootconfig"); 441 445 return; 442 446 } 443 447
+1 -1
kernel/bpf/core.c
··· 972 972 { 973 973 /* Only used as heuristic here to derive limit. */ 974 974 bpf_jit_limit_max = bpf_jit_alloc_exec_limit(); 975 - bpf_jit_limit = min_t(u64, round_up(bpf_jit_limit_max >> 2, 975 + bpf_jit_limit = min_t(u64, round_up(bpf_jit_limit_max >> 1, 976 976 PAGE_SIZE), LONG_MAX); 977 977 return 0; 978 978 }
+3 -3
kernel/events/core.c
··· 2163 2163 /* Inherit group flags from the previous leader */ 2164 2164 sibling->group_caps = event->group_caps; 2165 2165 2166 - if (!RB_EMPTY_NODE(&event->group_node)) { 2166 + if (sibling->attach_state & PERF_ATTACH_CONTEXT) { 2167 2167 add_event_to_groups(sibling, event->ctx); 2168 2168 2169 2169 if (sibling->state == PERF_EVENT_STATE_ACTIVE) ··· 3872 3872 if (likely(!ctx->nr_events)) 3873 3873 return; 3874 3874 3875 - if (is_active ^ EVENT_TIME) { 3875 + if (!(is_active & EVENT_TIME)) { 3876 3876 /* start ctx time */ 3877 3877 __update_context_time(ctx, false); 3878 3878 perf_cgroup_set_timestamp(cpuctx); ··· 9187 9187 9188 9188 perf_event_header__init_id(&bpf_event->event_id.header, 9189 9189 &sample, event); 9190 - ret = perf_output_begin(&handle, data, event, 9190 + ret = perf_output_begin(&handle, &sample, event, 9191 9191 bpf_event->event_id.header.size); 9192 9192 if (ret) 9193 9193 return;
+1 -1
kernel/trace/ftrace.c
··· 2592 2592 arch_ftrace_set_direct_caller(fregs, addr); 2593 2593 } 2594 2594 2595 - struct ftrace_ops direct_ops = { 2595 + static struct ftrace_ops direct_ops = { 2596 2596 .func = call_direct_funcs, 2597 2597 .flags = FTRACE_OPS_FL_DIRECT | FTRACE_OPS_FL_SAVE_REGS 2598 2598 | FTRACE_OPS_FL_PERMANENT,
+2 -2
kernel/trace/kprobe_event_gen_test.c
··· 146 146 if (trace_event_file_is_valid(gen_kprobe_test)) 147 147 gen_kprobe_test = NULL; 148 148 /* We got an error after creating the event, delete it */ 149 - ret = kprobe_event_delete("gen_kprobe_test"); 149 + kprobe_event_delete("gen_kprobe_test"); 150 150 goto out; 151 151 } 152 152 ··· 211 211 if (trace_event_file_is_valid(gen_kretprobe_test)) 212 212 gen_kretprobe_test = NULL; 213 213 /* We got an error after creating the event, delete it */ 214 - ret = kprobe_event_delete("gen_kretprobe_test"); 214 + kprobe_event_delete("gen_kretprobe_test"); 215 215 goto out; 216 216 } 217 217
-4
kernel/trace/ring_buffer.c
··· 354 354 local_set(&bpage->commit, 0); 355 355 } 356 356 357 - /* 358 - * Also stolen from mm/slob.c. Thanks to Mathieu Desnoyers for pointing 359 - * this issue out. 360 - */ 361 357 static void free_buffer_page(struct buffer_page *bpage) 362 358 { 363 359 free_page((unsigned long)bpage->page);
+2
kernel/trace/trace.c
··· 5167 5167 static const struct file_operations tracing_fops = { 5168 5168 .open = tracing_open, 5169 5169 .read = seq_read, 5170 + .read_iter = seq_read_iter, 5171 + .splice_read = generic_file_splice_read, 5170 5172 .write = tracing_write_stub, 5171 5173 .llseek = tracing_lseek, 5172 5174 .release = tracing_release,
+6 -5
kernel/trace/trace_hwlat.c
··· 339 339 cpumask_clear(current_mask); 340 340 cpumask_set_cpu(next_cpu, current_mask); 341 341 342 - sched_setaffinity(0, current_mask); 342 + set_cpus_allowed_ptr(current, current_mask); 343 343 return; 344 344 345 345 change_mode: ··· 446 446 447 447 } 448 448 449 - sched_setaffinity(kthread->pid, current_mask); 449 + set_cpus_allowed_ptr(kthread, current_mask); 450 450 451 451 kdata->kthread = kthread; 452 452 wake_up_process(kthread); ··· 491 491 static int start_cpu_kthread(unsigned int cpu) 492 492 { 493 493 struct task_struct *kthread; 494 + 495 + /* Do not start a new hwlatd thread if it is already running */ 496 + if (per_cpu(hwlat_per_cpu_data, cpu).kthread) 497 + return 0; 494 498 495 499 kthread = kthread_run_on_cpu(kthread_fn, NULL, cpu, "hwlatd/%u"); 496 500 if (IS_ERR(kthread)) { ··· 587 583 * Run only on CPUs in which hwlat is allowed to run. 588 584 */ 589 585 cpumask_and(current_mask, cpu_online_mask, tr->tracing_cpumask); 590 - 591 - for_each_online_cpu(cpu) 592 - per_cpu(hwlat_per_cpu_data, cpu).kthread = NULL; 593 586 594 587 for_each_cpu(cpu, current_mask) { 595 588 retval = start_cpu_kthread(cpu);
+5 -5
kernel/trace/trace_osnoise.c
··· 217 217 /* 218 218 * Per-cpu runtime information. 219 219 */ 220 - DEFINE_PER_CPU(struct osnoise_variables, per_cpu_osnoise_var); 220 + static DEFINE_PER_CPU(struct osnoise_variables, per_cpu_osnoise_var); 221 221 222 222 /* 223 223 * this_cpu_osn_var - Return the per-cpu osnoise_variables on its relative CPU ··· 240 240 u64 count; 241 241 }; 242 242 243 - DEFINE_PER_CPU(struct timerlat_variables, per_cpu_timerlat_var); 243 + static DEFINE_PER_CPU(struct timerlat_variables, per_cpu_timerlat_var); 244 244 245 245 /* 246 246 * this_cpu_tmr_var - Return the per-cpu timerlat_variables on its relative CPU ··· 332 332 /* 333 333 * Protect the interface. 334 334 */ 335 - struct mutex interface_lock; 335 + static struct mutex interface_lock; 336 336 337 337 /* 338 338 * Tracer data. ··· 2239 2239 /* 2240 2240 * osnoise/timerlat_period: min 100 us, max 1 s 2241 2241 */ 2242 - u64 timerlat_min_period = 100; 2243 - u64 timerlat_max_period = 1000000; 2242 + static u64 timerlat_min_period = 100; 2243 + static u64 timerlat_max_period = 1000000; 2244 2244 static struct trace_min_max_param timerlat_period = { 2245 2245 .lock = &interface_lock, 2246 2246 .val = &osnoise_data.timerlat_period,
+19 -4
net/bluetooth/hci_core.c
··· 2871 2871 return -ENXIO; 2872 2872 } 2873 2873 2874 - if (hci_skb_pkt_type(skb) != HCI_EVENT_PKT && 2875 - hci_skb_pkt_type(skb) != HCI_ACLDATA_PKT && 2876 - hci_skb_pkt_type(skb) != HCI_SCODATA_PKT && 2877 - hci_skb_pkt_type(skb) != HCI_ISODATA_PKT) { 2874 + switch (hci_skb_pkt_type(skb)) { 2875 + case HCI_EVENT_PKT: 2876 + break; 2877 + case HCI_ACLDATA_PKT: 2878 + /* Detect if ISO packet has been sent as ACL */ 2879 + if (hci_conn_num(hdev, ISO_LINK)) { 2880 + __u16 handle = __le16_to_cpu(hci_acl_hdr(skb)->handle); 2881 + __u8 type; 2882 + 2883 + type = hci_conn_lookup_type(hdev, hci_handle(handle)); 2884 + if (type == ISO_LINK) 2885 + hci_skb_pkt_type(skb) = HCI_ISODATA_PKT; 2886 + } 2887 + break; 2888 + case HCI_SCODATA_PKT: 2889 + break; 2890 + case HCI_ISODATA_PKT: 2891 + break; 2892 + default: 2878 2893 kfree_skb(skb); 2879 2894 return -EINVAL; 2880 2895 }
+48 -20
net/bluetooth/hci_sync.c
··· 643 643 cancel_work_sync(&hdev->cmd_sync_work); 644 644 cancel_work_sync(&hdev->reenable_adv_work); 645 645 646 + mutex_lock(&hdev->cmd_sync_work_lock); 646 647 list_for_each_entry_safe(entry, tmp, &hdev->cmd_sync_work_list, list) { 647 648 if (entry->destroy) 648 649 entry->destroy(hdev, entry->data, -ECANCELED); ··· 651 650 list_del(&entry->list); 652 651 kfree(entry); 653 652 } 653 + mutex_unlock(&hdev->cmd_sync_work_lock); 654 654 } 655 655 656 656 void __hci_cmd_sync_cancel(struct hci_dev *hdev, int err) ··· 2369 2367 return err; 2370 2368 } 2371 2369 2370 + static int hci_pause_addr_resolution(struct hci_dev *hdev) 2371 + { 2372 + int err; 2373 + 2374 + if (!use_ll_privacy(hdev)) 2375 + return 0; 2376 + 2377 + if (!hci_dev_test_flag(hdev, HCI_LL_RPA_RESOLUTION)) 2378 + return 0; 2379 + 2380 + /* Cannot disable addr resolution if scanning is enabled or 2381 + * when initiating an LE connection. 2382 + */ 2383 + if (hci_dev_test_flag(hdev, HCI_LE_SCAN) || 2384 + hci_lookup_le_connect(hdev)) { 2385 + bt_dev_err(hdev, "Command not allowed when scan/LE connect"); 2386 + return -EPERM; 2387 + } 2388 + 2389 + /* Cannot disable addr resolution if advertising is enabled. */ 2390 + err = hci_pause_advertising_sync(hdev); 2391 + if (err) { 2392 + bt_dev_err(hdev, "Pause advertising failed: %d", err); 2393 + return err; 2394 + } 2395 + 2396 + err = hci_le_set_addr_resolution_enable_sync(hdev, 0x00); 2397 + if (err) 2398 + bt_dev_err(hdev, "Unable to disable Address Resolution: %d", 2399 + err); 2400 + 2401 + /* Return if address resolution is disabled and RPA is not used. */ 2402 + if (!err && scan_use_rpa(hdev)) 2403 + return err; 2404 + 2405 + hci_resume_advertising_sync(hdev); 2406 + return err; 2407 + } 2408 + 2372 2409 struct sk_buff *hci_read_local_oob_data_sync(struct hci_dev *hdev, 2373 2410 bool extended, struct sock *sk) 2374 2411 { ··· 2443 2402 u8 filter_policy; 2444 2403 int err; 2445 2404 2446 - /* Pause advertising if resolving list can be used as controllers are 2405 + /* Pause advertising if resolving list can be used as controllers 2447 2406 * cannot accept resolving list modifications while advertising. 2448 2407 */ 2449 2408 if (use_ll_privacy(hdev)) { ··· 3360 3319 HCI_INIT(hci_read_flow_control_mode_sync), 3361 3320 /* HCI_OP_READ_LOCATION_DATA */ 3362 3321 HCI_INIT(hci_read_location_data_sync), 3322 + {} 3363 3323 }; 3364 3324 3365 3325 static int hci_init1_sync(struct hci_dev *hdev) ··· 3395 3353 static const struct hci_init_stage amp_init2[] = { 3396 3354 /* HCI_OP_READ_LOCAL_FEATURES */ 3397 3355 HCI_INIT(hci_read_local_features_sync), 3356 + {} 3398 3357 }; 3399 3358 3400 3359 /* Read Buffer Size (ACL mtu, max pkt, etc.) */ ··· 5437 5394 5438 5395 cancel_interleave_scan(hdev); 5439 5396 5440 - /* Pause advertising since active scanning disables address resolution 5441 - * which advertising depend on in order to generate its RPAs. 5397 + /* Pause address resolution for active scan and stop advertising if 5398 + * privacy is enabled. 5442 5399 */ 5443 - if (use_ll_privacy(hdev) && hci_dev_test_flag(hdev, HCI_PRIVACY)) { 5444 - err = hci_pause_advertising_sync(hdev); 5445 - if (err) { 5446 - bt_dev_err(hdev, "pause advertising failed: %d", err); 5447 - goto failed; 5448 - } 5449 - } 5450 - 5451 - /* Disable address resolution while doing active scanning since the 5452 - * accept list shall not be used and all reports shall reach the host 5453 - * anyway. 5454 - */ 5455 - err = hci_le_set_addr_resolution_enable_sync(hdev, 0x00); 5456 - if (err) { 5457 - bt_dev_err(hdev, "Unable to disable Address Resolution: %d", 5458 - err); 5400 + err = hci_pause_addr_resolution(hdev); 5401 + if (err) 5459 5402 goto failed; 5460 - } 5461 5403 5462 5404 /* All active scans will be done with either a resolvable private 5463 5405 * address (when privacy feature has been enabled) or non-resolvable
+7 -2
net/bluetooth/iso.c
··· 1620 1620 void iso_recv(struct hci_conn *hcon, struct sk_buff *skb, u16 flags) 1621 1621 { 1622 1622 struct iso_conn *conn = hcon->iso_data; 1623 - struct hci_iso_data_hdr *hdr; 1624 1623 __u16 pb, ts, len; 1625 1624 1626 1625 if (!conn) ··· 1641 1642 } 1642 1643 1643 1644 if (ts) { 1645 + struct hci_iso_ts_data_hdr *hdr; 1646 + 1644 1647 /* TODO: add timestamp to the packet? */ 1645 1648 hdr = skb_pull_data(skb, HCI_ISO_TS_DATA_HDR_SIZE); 1646 1649 if (!hdr) { ··· 1650 1649 goto drop; 1651 1650 } 1652 1651 1652 + len = __le16_to_cpu(hdr->slen); 1653 1653 } else { 1654 + struct hci_iso_data_hdr *hdr; 1655 + 1654 1656 hdr = skb_pull_data(skb, HCI_ISO_DATA_HDR_SIZE); 1655 1657 if (!hdr) { 1656 1658 BT_ERR("Frame is too short (len %d)", skb->len); 1657 1659 goto drop; 1658 1660 } 1661 + 1662 + len = __le16_to_cpu(hdr->slen); 1659 1663 } 1660 1664 1661 - len = __le16_to_cpu(hdr->slen); 1662 1665 flags = hci_iso_data_flags(len); 1663 1666 len = hci_iso_data_len(len); 1664 1667
+87 -46
net/bluetooth/l2cap_core.c
··· 708 708 } 709 709 EXPORT_SYMBOL_GPL(l2cap_chan_del); 710 710 711 + static void __l2cap_chan_list_id(struct l2cap_conn *conn, u16 id, 712 + l2cap_chan_func_t func, void *data) 713 + { 714 + struct l2cap_chan *chan, *l; 715 + 716 + list_for_each_entry_safe(chan, l, &conn->chan_l, list) { 717 + if (chan->ident == id) 718 + func(chan, data); 719 + } 720 + } 721 + 711 722 static void __l2cap_chan_list(struct l2cap_conn *conn, l2cap_chan_func_t func, 712 723 void *data) 713 724 { ··· 786 775 787 776 static void l2cap_chan_ecred_connect_reject(struct l2cap_chan *chan) 788 777 { 789 - struct l2cap_conn *conn = chan->conn; 790 - struct l2cap_ecred_conn_rsp rsp; 791 - u16 result; 792 - 793 - if (test_bit(FLAG_DEFER_SETUP, &chan->flags)) 794 - result = L2CAP_CR_LE_AUTHORIZATION; 795 - else 796 - result = L2CAP_CR_LE_BAD_PSM; 797 - 798 778 l2cap_state_change(chan, BT_DISCONN); 799 779 800 - memset(&rsp, 0, sizeof(rsp)); 801 - 802 - rsp.result = cpu_to_le16(result); 803 - 804 - l2cap_send_cmd(conn, chan->ident, L2CAP_LE_CONN_RSP, sizeof(rsp), 805 - &rsp); 780 + __l2cap_ecred_conn_rsp_defer(chan); 806 781 } 807 782 808 783 static void l2cap_chan_connect_reject(struct l2cap_chan *chan) ··· 843 846 break; 844 847 case L2CAP_MODE_EXT_FLOWCTL: 845 848 l2cap_chan_ecred_connect_reject(chan); 846 - break; 849 + return; 847 850 } 848 851 } 849 852 } ··· 3935 3938 &rsp); 3936 3939 } 3937 3940 3938 - void __l2cap_ecred_conn_rsp_defer(struct l2cap_chan *chan) 3941 + static void l2cap_ecred_list_defer(struct l2cap_chan *chan, void *data) 3939 3942 { 3940 - struct { 3941 - struct l2cap_ecred_conn_rsp rsp; 3942 - __le16 dcid[5]; 3943 - } __packed pdu; 3944 - struct l2cap_conn *conn = chan->conn; 3945 - u16 ident = chan->ident; 3946 - int i = 0; 3943 + int *result = data; 3947 3944 3948 - if (!ident) 3945 + if (*result || test_bit(FLAG_ECRED_CONN_REQ_SENT, &chan->flags)) 3949 3946 return; 3950 3947 3951 - BT_DBG("chan %p ident %d", chan, ident); 3952 - 3953 - pdu.rsp.mtu = cpu_to_le16(chan->imtu); 3954 - pdu.rsp.mps = cpu_to_le16(chan->mps); 3955 - pdu.rsp.credits = cpu_to_le16(chan->rx_credits); 3956 - pdu.rsp.result = cpu_to_le16(L2CAP_CR_LE_SUCCESS); 3957 - 3958 - mutex_lock(&conn->chan_lock); 3959 - 3960 - list_for_each_entry(chan, &conn->chan_l, list) { 3961 - if (chan->ident != ident) 3962 - continue; 3963 - 3964 - /* Reset ident so only one response is sent */ 3965 - chan->ident = 0; 3966 - 3967 - /* Include all channels pending with the same ident */ 3968 - pdu.dcid[i++] = cpu_to_le16(chan->scid); 3948 + switch (chan->state) { 3949 + case BT_CONNECT2: 3950 + /* If channel still pending accept add to result */ 3951 + (*result)++; 3952 + return; 3953 + case BT_CONNECTED: 3954 + return; 3955 + default: 3956 + /* If not connected or pending accept it has been refused */ 3957 + *result = -ECONNREFUSED; 3958 + return; 3969 3959 } 3960 + } 3970 3961 3971 - mutex_unlock(&conn->chan_lock); 3962 + struct l2cap_ecred_rsp_data { 3963 + struct { 3964 + struct l2cap_ecred_conn_rsp rsp; 3965 + __le16 scid[L2CAP_ECRED_MAX_CID]; 3966 + } __packed pdu; 3967 + int count; 3968 + }; 3972 3969 3973 - l2cap_send_cmd(conn, ident, L2CAP_ECRED_CONN_RSP, 3974 - sizeof(pdu.rsp) + i * sizeof(__le16), &pdu); 3970 + static void l2cap_ecred_rsp_defer(struct l2cap_chan *chan, void *data) 3971 + { 3972 + struct l2cap_ecred_rsp_data *rsp = data; 3973 + 3974 + if (test_bit(FLAG_ECRED_CONN_REQ_SENT, &chan->flags)) 3975 + return; 3976 + 3977 + /* Reset ident so only one response is sent */ 3978 + chan->ident = 0; 3979 + 3980 + /* Include all channels pending with the same ident */ 3981 + if (!rsp->pdu.rsp.result) 3982 + rsp->pdu.rsp.dcid[rsp->count++] = cpu_to_le16(chan->scid); 3983 + else 3984 + l2cap_chan_del(chan, ECONNRESET); 3985 + } 3986 + 3987 + void __l2cap_ecred_conn_rsp_defer(struct l2cap_chan *chan) 3988 + { 3989 + struct l2cap_conn *conn = chan->conn; 3990 + struct l2cap_ecred_rsp_data data; 3991 + u16 id = chan->ident; 3992 + int result = 0; 3993 + 3994 + if (!id) 3995 + return; 3996 + 3997 + BT_DBG("chan %p id %d", chan, id); 3998 + 3999 + memset(&data, 0, sizeof(data)); 4000 + 4001 + data.pdu.rsp.mtu = cpu_to_le16(chan->imtu); 4002 + data.pdu.rsp.mps = cpu_to_le16(chan->mps); 4003 + data.pdu.rsp.credits = cpu_to_le16(chan->rx_credits); 4004 + data.pdu.rsp.result = cpu_to_le16(L2CAP_CR_LE_SUCCESS); 4005 + 4006 + /* Verify that all channels are ready */ 4007 + __l2cap_chan_list_id(conn, id, l2cap_ecred_list_defer, &result); 4008 + 4009 + if (result > 0) 4010 + return; 4011 + 4012 + if (result < 0) 4013 + data.pdu.rsp.result = cpu_to_le16(L2CAP_CR_LE_AUTHORIZATION); 4014 + 4015 + /* Build response */ 4016 + __l2cap_chan_list_id(conn, id, l2cap_ecred_rsp_defer, &data); 4017 + 4018 + l2cap_send_cmd(conn, id, L2CAP_ECRED_CONN_RSP, 4019 + sizeof(data.pdu.rsp) + (data.count * sizeof(__le16)), 4020 + &data.pdu); 3975 4021 } 3976 4022 3977 4023 void __l2cap_connect_rsp_defer(struct l2cap_chan *chan) ··· 6118 6078 __set_chan_timer(chan, chan->ops->get_sndtimeo(chan)); 6119 6079 6120 6080 chan->ident = cmd->ident; 6081 + chan->mode = L2CAP_MODE_EXT_FLOWCTL; 6121 6082 6122 6083 if (test_bit(FLAG_DEFER_SETUP, &chan->flags)) { 6123 6084 l2cap_state_change(chan, BT_CONNECT2);
+2 -7
net/bluetooth/mgmt.c
··· 4639 4639 MGMT_OP_SET_EXP_FEATURE, 4640 4640 MGMT_STATUS_INVALID_INDEX); 4641 4641 4642 - /* Changes can only be made when controller is powered down */ 4643 - if (hdev_is_powered(hdev)) 4644 - return mgmt_cmd_status(sk, hdev->id, 4645 - MGMT_OP_SET_EXP_FEATURE, 4646 - MGMT_STATUS_REJECTED); 4647 - 4648 4642 /* Parameters are limited to a single octet */ 4649 4643 if (data_len != MGMT_SET_EXP_FEATURE_SIZE + 1) 4650 4644 return mgmt_cmd_status(sk, hdev->id, ··· 9357 9363 { add_ext_adv_data, MGMT_ADD_EXT_ADV_DATA_SIZE, 9358 9364 HCI_MGMT_VAR_LEN }, 9359 9365 { add_adv_patterns_monitor_rssi, 9360 - MGMT_ADD_ADV_PATTERNS_MONITOR_RSSI_SIZE }, 9366 + MGMT_ADD_ADV_PATTERNS_MONITOR_RSSI_SIZE, 9367 + HCI_MGMT_VAR_LEN }, 9361 9368 { set_mesh, MGMT_SET_MESH_RECEIVER_SIZE, 9362 9369 HCI_MGMT_VAR_LEN }, 9363 9370 { mesh_features, MGMT_MESH_READ_FEATURES_SIZE },
+8 -2
net/core/xdp.c
··· 720 720 * @ctx: XDP context pointer. 721 721 * @timestamp: Return value pointer. 722 722 * 723 - * Returns 0 on success or ``-errno`` on error. 723 + * Return: 724 + * * Returns 0 on success or ``-errno`` on error. 725 + * * ``-EOPNOTSUPP`` : means device driver does not implement kfunc 726 + * * ``-ENODATA`` : means no RX-timestamp available for this frame 724 727 */ 725 728 __bpf_kfunc int bpf_xdp_metadata_rx_timestamp(const struct xdp_md *ctx, u64 *timestamp) 726 729 { ··· 735 732 * @ctx: XDP context pointer. 736 733 * @hash: Return value pointer. 737 734 * 738 - * Returns 0 on success or ``-errno`` on error. 735 + * Return: 736 + * * Returns 0 on success or ``-errno`` on error. 737 + * * ``-EOPNOTSUPP`` : means device driver doesn't implement kfunc 738 + * * ``-ENODATA`` : means no RX-hash available for this frame 739 739 */ 740 740 __bpf_kfunc int bpf_xdp_metadata_rx_hash(const struct xdp_md *ctx, u32 *hash) 741 741 {
+1 -1
net/dsa/tag.c
··· 114 114 skb = nskb; 115 115 } 116 116 117 - dev_sw_netstats_rx_add(skb->dev, skb->len); 117 + dev_sw_netstats_rx_add(skb->dev, skb->len + ETH_HLEN); 118 118 119 119 if (dsa_skb_defer_rx_timestamp(p, skb)) 120 120 return 0;
+8 -2
net/dsa/tag_brcm.c
··· 7 7 8 8 #include <linux/dsa/brcm.h> 9 9 #include <linux/etherdevice.h> 10 + #include <linux/if_vlan.h> 10 11 #include <linux/list.h> 11 12 #include <linux/slab.h> 12 13 ··· 253 252 static struct sk_buff *brcm_leg_tag_rcv(struct sk_buff *skb, 254 253 struct net_device *dev) 255 254 { 255 + int len = BRCM_LEG_TAG_LEN; 256 256 int source_port; 257 257 u8 *brcm_tag; 258 258 ··· 268 266 if (!skb->dev) 269 267 return NULL; 270 268 269 + /* VLAN tag is added by BCM63xx internal switch */ 270 + if (netdev_uses_dsa(skb->dev)) 271 + len += VLAN_HLEN; 272 + 271 273 /* Remove Broadcom tag and update checksum */ 272 - skb_pull_rcsum(skb, BRCM_LEG_TAG_LEN); 274 + skb_pull_rcsum(skb, len); 273 275 274 276 dsa_default_offload_fwd_mark(skb); 275 277 276 - dsa_strip_etype_header(skb, BRCM_LEG_TAG_LEN); 278 + dsa_strip_etype_header(skb, len); 277 279 278 280 return skb; 279 281 }
+2 -2
net/ipv4/ip_gre.c
··· 552 552 truncate = true; 553 553 } 554 554 555 - nhoff = skb_network_header(skb) - skb_mac_header(skb); 555 + nhoff = skb_network_offset(skb); 556 556 if (skb->protocol == htons(ETH_P_IP) && 557 557 (ntohs(ip_hdr(skb)->tot_len) > skb->len - nhoff)) 558 558 truncate = true; ··· 561 561 int thoff; 562 562 563 563 if (skb_transport_header_was_set(skb)) 564 - thoff = skb_transport_header(skb) - skb_mac_header(skb); 564 + thoff = skb_transport_offset(skb); 565 565 else 566 566 thoff = nhoff + sizeof(struct ipv6hdr); 567 567 if (ntohs(ipv6_hdr(skb)->payload_len) > skb->len - thoff)
+2 -2
net/ipv6/ip6_gre.c
··· 959 959 truncate = true; 960 960 } 961 961 962 - nhoff = skb_network_header(skb) - skb_mac_header(skb); 962 + nhoff = skb_network_offset(skb); 963 963 if (skb->protocol == htons(ETH_P_IP) && 964 964 (ntohs(ip_hdr(skb)->tot_len) > skb->len - nhoff)) 965 965 truncate = true; ··· 968 968 int thoff; 969 969 970 970 if (skb_transport_header_was_set(skb)) 971 - thoff = skb_transport_header(skb) - skb_mac_header(skb); 971 + thoff = skb_transport_offset(skb); 972 972 else 973 973 thoff = nhoff + sizeof(struct ipv6hdr); 974 974 if (ntohs(ipv6_hdr(skb)->payload_len) > skb->len - thoff)
+3
net/mac80211/ieee80211_i.h
··· 1288 1288 struct list_head active_txqs[IEEE80211_NUM_ACS]; 1289 1289 u16 schedule_round[IEEE80211_NUM_ACS]; 1290 1290 1291 + /* serializes ieee80211_handle_wake_tx_queue */ 1292 + spinlock_t handle_wake_tx_queue_lock; 1293 + 1291 1294 u16 airtime_flags; 1292 1295 u32 aql_txq_limit_low[IEEE80211_NUM_ACS]; 1293 1296 u32 aql_txq_limit_high[IEEE80211_NUM_ACS];
+2
net/mac80211/main.c
··· 802 802 local->aql_threshold = IEEE80211_AQL_THRESHOLD; 803 803 atomic_set(&local->aql_total_pending_airtime, 0); 804 804 805 + spin_lock_init(&local->handle_wake_tx_queue_lock); 806 + 805 807 INIT_LIST_HEAD(&local->chanctx_list); 806 808 mutex_init(&local->chanctx_mtx); 807 809
+11 -11
net/mac80211/rx.c
··· 2746 2746 mesh_rmc_check(sdata, eth->h_source, mesh_hdr)) 2747 2747 return RX_DROP_MONITOR; 2748 2748 2749 - /* Frame has reached destination. Don't forward */ 2750 - if (ether_addr_equal(sdata->vif.addr, eth->h_dest)) 2751 - goto rx_accept; 2752 - 2753 - if (!ifmsh->mshcfg.dot11MeshForwarding) { 2754 - if (is_multicast_ether_addr(eth->h_dest)) 2755 - goto rx_accept; 2756 - 2757 - return RX_DROP_MONITOR; 2758 - } 2759 - 2760 2749 /* forward packet */ 2761 2750 if (sdata->crypto_tx_tailroom_needed_cnt) 2762 2751 tailroom = IEEE80211_ENCRYPT_TAILROOM; ··· 2782 2793 spin_unlock_bh(&mppath->state_lock); 2783 2794 } 2784 2795 rcu_read_unlock(); 2796 + } 2797 + 2798 + /* Frame has reached destination. Don't forward */ 2799 + if (ether_addr_equal(sdata->vif.addr, eth->h_dest)) 2800 + goto rx_accept; 2801 + 2802 + if (!ifmsh->mshcfg.dot11MeshForwarding) { 2803 + if (is_multicast_ether_addr(eth->h_dest)) 2804 + goto rx_accept; 2805 + 2806 + return RX_DROP_MONITOR; 2785 2807 } 2786 2808 2787 2809 skb_set_queue_mapping(skb, ieee802_1d_to_ac[skb->priority]);
+3
net/mac80211/util.c
··· 314 314 struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->vif); 315 315 struct ieee80211_txq *queue; 316 316 317 + spin_lock(&local->handle_wake_tx_queue_lock); 318 + 317 319 /* Use ieee80211_next_txq() for airtime fairness accounting */ 318 320 ieee80211_txq_schedule_start(hw, txq->ac); 319 321 while ((queue = ieee80211_next_txq(hw, txq->ac))) { ··· 323 321 ieee80211_return_txq(hw, queue, false); 324 322 } 325 323 ieee80211_txq_schedule_end(hw, txq->ac); 324 + spin_unlock(&local->handle_wake_tx_queue_lock); 326 325 } 327 326 EXPORT_SYMBOL(ieee80211_handle_wake_tx_queue); 328 327
+4 -2
net/mac80211/wme.c
··· 147 147 u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, 148 148 struct sta_info *sta, struct sk_buff *skb) 149 149 { 150 + const struct ethhdr *eth = (void *)skb->data; 150 151 struct mac80211_qos_map *qos_map; 151 152 bool qos; 152 153 ··· 155 154 skb_get_hash(skb); 156 155 157 156 /* all mesh/ocb stations are required to support WME */ 158 - if (sta && (sdata->vif.type == NL80211_IFTYPE_MESH_POINT || 159 - sdata->vif.type == NL80211_IFTYPE_OCB)) 157 + if ((sdata->vif.type == NL80211_IFTYPE_MESH_POINT && 158 + !is_multicast_ether_addr(eth->h_dest)) || 159 + (sdata->vif.type == NL80211_IFTYPE_OCB && sta)) 160 160 qos = true; 161 161 else if (sta) 162 162 qos = sta->sta.wme;
+7 -6
net/xdp/xdp_umem.c
··· 150 150 151 151 static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr) 152 152 { 153 - u32 npgs_rem, chunk_size = mr->chunk_size, headroom = mr->headroom; 154 153 bool unaligned_chunks = mr->flags & XDP_UMEM_UNALIGNED_CHUNK_FLAG; 155 - u64 npgs, addr = mr->addr, size = mr->len; 156 - unsigned int chunks, chunks_rem; 154 + u32 chunk_size = mr->chunk_size, headroom = mr->headroom; 155 + u64 addr = mr->addr, size = mr->len; 156 + u32 chunks_rem, npgs_rem; 157 + u64 chunks, npgs; 157 158 int err; 158 159 159 160 if (chunk_size < XDP_UMEM_MIN_CHUNK_SIZE || chunk_size > PAGE_SIZE) { ··· 189 188 if (npgs > U32_MAX) 190 189 return -EINVAL; 191 190 192 - chunks = (unsigned int)div_u64_rem(size, chunk_size, &chunks_rem); 193 - if (chunks == 0) 191 + chunks = div_u64_rem(size, chunk_size, &chunks_rem); 192 + if (!chunks || chunks > U32_MAX) 194 193 return -EINVAL; 195 194 196 195 if (!unaligned_chunks && chunks_rem) ··· 203 202 umem->headroom = headroom; 204 203 umem->chunk_size = chunk_size; 205 204 umem->chunks = chunks; 206 - umem->npgs = (u32)npgs; 205 + umem->npgs = npgs; 207 206 umem->pgs = NULL; 208 207 umem->user = NULL; 209 208 umem->flags = mr->flags;
-1
scripts/.gitignore
··· 3 3 /generate_rust_target 4 4 /insert-sys-cert 5 5 /kallsyms 6 - /list-gitignored 7 6 /module.lds 8 7 /recordmcount 9 8 /sign-file
+1 -1
scripts/Makefile
··· 38 38 endif 39 39 40 40 # The following programs are only built on demand 41 - hostprogs += list-gitignored unifdef 41 + hostprogs += unifdef 42 42 43 43 # The module linker script is preprocessed on demand 44 44 targets += module.lds
+69 -79
scripts/Makefile.package
··· 2 2 # Makefile for the different targets used to generate full packages of a kernel 3 3 4 4 include $(srctree)/scripts/Kbuild.include 5 + include $(srctree)/scripts/Makefile.lib 5 6 6 7 KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE)) 7 8 KBUILD_PKG_ROOTCMD ?="fakeroot -u" ··· 27 26 tar -I $(KGZIP) -c $(RCS_TAR_IGNORE) -f $(2).tar.gz \ 28 27 --transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3) 29 28 30 - # .tmp_filelist .tmp_filelist_exclude 29 + # tarball compression 31 30 # --------------------------------------------------------------------------- 32 31 33 - scripts/list-gitignored: FORCE 34 - $(Q)$(MAKE) -f $(srctree)/Makefile scripts_package 32 + %.tar.gz: %.tar 33 + $(call cmd,gzip) 35 34 36 - # 1f5d3a6b6532e25a5cdf1f311956b2b03d343a48 removed '*.rej' from .gitignore, 37 - # but it is definitely a generated file. 38 - filechk_filelist = \ 39 - $< --exclude='*.rej' --output=$@_exclude --prefix=./ --rootdir=$(srctree) --stat=- 35 + %.tar.bz2: %.tar 36 + $(call cmd,bzip2) 40 37 41 - .tmp_filelist: scripts/list-gitignored FORCE 42 - $(call filechk,filelist) 38 + %.tar.xz: %.tar 39 + $(call cmd,xzmisc) 43 40 44 - # tarball 41 + %.tar.zst: %.tar 42 + $(call cmd,zstd) 43 + 44 + # Git 45 45 # --------------------------------------------------------------------------- 46 46 47 - quiet_cmd_tar = TAR $@ 48 - cmd_tar = tar -c -f $@ $(tar-compress-opt) $(tar-exclude-opt) \ 49 - --owner=0 --group=0 --sort=name \ 50 - --transform 's:^\.:$*:S' -C $(tar-rootdir) . 47 + filechk_HEAD = git -C $(srctree) rev-parse --verify HEAD 2>/dev/null 51 48 52 - tar-rootdir := $(srctree) 49 + .tmp_HEAD: check-git FORCE 50 + $(call filechk,HEAD) 53 51 54 - %.tar: 55 - $(call cmd,tar) 56 - 57 - %.tar.gz: private tar-compress-opt := -I $(KGZIP) 58 - %.tar.gz: 59 - $(call cmd,tar) 60 - 61 - %.tar.bz2: private tar-compress-opt := -I $(KBZIP2) 62 - %.tar.bz2: 63 - $(call cmd,tar) 64 - 65 - %.tar.xz: private tar-compress-opt := -I $(XZ) 66 - %.tar.xz: 67 - $(call cmd,tar) 68 - 69 - %.tar.zst: private tar-compress-opt := -I $(ZSTD) 70 - %.tar.zst: 71 - $(call cmd,tar) 52 + PHONY += check-git 53 + check-git: 54 + @if ! $(srctree)/scripts/check-git; then \ 55 + echo >&2 "error: creating source package requires git repository"; \ 56 + false; \ 57 + fi 72 58 73 59 # Linux source tarball 74 60 # --------------------------------------------------------------------------- 75 61 76 - linux.tar.gz: tar-exclude-opt = --exclude=./$@ --exclude-from=$<_exclude 77 - linux.tar.gz: .tmp_filelist 62 + quiet_cmd_archive_linux = ARCHIVE $@ 63 + cmd_archive_linux = \ 64 + git -C $(srctree) archive --output=$$(realpath $@) --prefix=$(basename $@)/ $$(cat $<) 65 + 66 + targets += linux.tar 67 + linux.tar: .tmp_HEAD FORCE 68 + $(call if_changed,archive_linux) 78 69 79 70 # rpm-pkg 80 71 # --------------------------------------------------------------------------- ··· 82 89 srcrpm-pkg: linux.tar.gz 83 90 $(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec 84 91 +rpmbuild $(RPMOPTS) --target $(UTS_MACHINE)-linux -bs kernel.spec \ 85 - --define='_smp_mflags %{nil}' --define='_sourcedir .' --define='_srcrpmdir .' 92 + --define='_smp_mflags %{nil}' --define='_sourcedir rpmbuild/SOURCES' --define='_srcrpmdir .' 86 93 87 94 # binrpm-pkg 88 95 # --------------------------------------------------------------------------- ··· 141 148 # dir-pkg tar*-pkg - tarball targets 142 149 # --------------------------------------------------------------------------- 143 150 144 - tar-pkg-tarball = linux-$(KERNELRELEASE)-$(ARCH).$(1) 145 - tar-pkg-phony = $(subst .,,$(1))-pkg 146 - 147 151 tar-install: FORCE 148 152 $(Q)$(MAKE) -f $(srctree)/Makefile 149 153 +$(Q)$(srctree)/scripts/package/buildtar $@ 154 + 155 + quiet_cmd_tar = TAR $@ 156 + cmd_tar = cd $<; tar cf ../$@ --owner=root --group=root --sort=name * 157 + 158 + linux-$(KERNELRELEASE)-$(ARCH).tar: tar-install 159 + $(call cmd,tar) 150 160 151 161 PHONY += dir-pkg 152 162 dir-pkg: tar-install 153 163 @echo "Kernel tree successfully created in $<" 154 164 155 - define tar-pkg-rule 156 - PHONY += $(tar-pkg-phony) 157 - $(tar-pkg-phony): $(tar-pkg-tarball) 165 + PHONY += tar-pkg 166 + tar-pkg: linux-$(KERNELRELEASE)-$(ARCH).tar 158 167 @: 159 168 160 - $(tar-pkg-tarball): private tar-rootdir := tar-install 161 - $(tar-pkg-tarball): tar-install 162 - endef 163 - 164 - $(foreach x, tar tar.gz tar.bz2 tar.xz tar.zst, $(eval $(call tar-pkg-rule,$(x)))) 169 + tar%-pkg: linux-$(KERNELRELEASE)-$(ARCH).tar.% FORCE 170 + @: 165 171 166 172 # perf-tar*-src-pkg - generate a source tarball with perf source 167 173 # --------------------------------------------------------------------------- 168 174 169 - perf-tar-src-pkg-tarball = perf-$(KERNELVERSION).$(1) 170 - perf-tar-src-pkg-phony = perf-$(subst .,,$(1))-src-pkg 175 + .tmp_perf: 176 + $(Q)mkdir .tmp_perf 171 177 172 - quiet_cmd_stage_perf_src = STAGE $@ 173 - cmd_stage_perf_src = \ 174 - rm -rf $@; \ 175 - mkdir -p $@; \ 176 - tar -c -f - --exclude-from=$<_exclude -C $(srctree) --files-from=$(srctree)/tools/perf/MANIFEST | \ 177 - tar -x -f - -C $@ 178 - 179 - .tmp_perf: .tmp_filelist 180 - $(call cmd,stage_perf_src) 181 - 182 - filechk_perf_head = \ 183 - if test -z "$(git -C $(srctree) rev-parse --show-cdup 2>/dev/null)" && \ 184 - head=$$(git -C $(srctree) rev-parse --verify HEAD 2>/dev/null); then \ 185 - echo $$head; \ 186 - else \ 187 - echo "not a git tree"; \ 188 - fi 189 - 190 - .tmp_perf/HEAD: .tmp_perf FORCE 191 - $(call filechk,perf_head) 178 + .tmp_perf/HEAD: .tmp_HEAD | .tmp_perf 179 + $(call cmd,copy) 192 180 193 181 quiet_cmd_perf_version_file = GEN $@ 194 182 cmd_perf_version_file = cd $(srctree)/tools/perf; util/PERF-VERSION-GEN $(dir $(abspath $@)) 195 183 196 - # PERF-VERSION-FILE and HEAD are independent, but this avoids updating the 184 + # PERF-VERSION-FILE and .tmp_HEAD are independent, but this avoids updating the 197 185 # timestamp of PERF-VERSION-FILE. 198 186 # The best is to fix tools/perf/util/PERF-VERSION-GEN. 199 - .tmp_perf/PERF-VERSION-FILE: .tmp_perf/HEAD $(srctree)/tools/perf/util/PERF-VERSION-GEN 187 + .tmp_perf/PERF-VERSION-FILE: .tmp_HEAD $(srctree)/tools/perf/util/PERF-VERSION-GEN | .tmp_perf 200 188 $(call cmd,perf_version_file) 201 189 202 - define perf-tar-src-pkg-rule 203 - PHONY += $(perf-tar-src-pkg-phony) 204 - $(perf-tar-src-pkg-phony): $(perf-tar-src-pkg-tarball) 190 + quiet_cmd_archive_perf = ARCHIVE $@ 191 + cmd_archive_perf = \ 192 + git -C $(srctree) archive --output=$$(realpath $@) --prefix=$(basename $@)/ \ 193 + --add-file=$$(realpath $(word 2, $^)) \ 194 + --add-file=$$(realpath $(word 3, $^)) \ 195 + $$(cat $(word 2, $^))^{tree} $$(cat $<) 196 + 197 + targets += perf-$(KERNELVERSION).tar 198 + perf-$(KERNELVERSION).tar: tools/perf/MANIFEST .tmp_perf/HEAD .tmp_perf/PERF-VERSION-FILE FORCE 199 + $(call if_changed,archive_perf) 200 + 201 + PHONY += perf-tar-src-pkg 202 + perf-tar-src-pkg: perf-$(KERNELVERSION).tar 205 203 @: 206 204 207 - $(perf-tar-src-pkg-tarball): private tar-rootdir := .tmp_perf 208 - $(perf-tar-src-pkg-tarball): .tmp_filelist .tmp_perf/HEAD .tmp_perf/PERF-VERSION-FILE 209 - endef 210 - 211 - $(foreach x, tar tar.gz tar.bz2 tar.xz tar.zst, $(eval $(call perf-tar-src-pkg-rule,$(x)))) 205 + perf-tar%-src-pkg: perf-$(KERNELVERSION).tar.% FORCE 206 + @: 212 207 213 208 # Help text displayed when executing 'make help' 214 209 # --------------------------------------------------------------------------- ··· 223 242 224 243 PHONY += FORCE 225 244 FORCE: 245 + 246 + # Read all saved command lines and dependencies for the $(targets) we 247 + # may be building above, using $(if_changed{,_dep}). As an 248 + # optimization, we don't need to read them if the target does not 249 + # exist, we will rebuild anyway in that case. 250 + 251 + existing-targets := $(wildcard $(sort $(targets))) 252 + 253 + -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd) 226 254 227 255 .PHONY: $(PHONY)
+14
scripts/check-git
··· 1 + #!/bin/sh 2 + # SPDX-License-Identifier: GPL-2.0-only 3 + # 4 + # succeed if we are in a git repository 5 + 6 + srctree="$(dirname $0)/.." 7 + 8 + if ! git -C "${srctree}" rev-parse --verify HEAD >/dev/null 2>/dev/null; then 9 + exit 1 10 + fi 11 + 12 + if ! test -z $(git -C "${srctree}" rev-parse --show-cdup 2>/dev/null); then 13 + exit 1 14 + fi
+1
scripts/kallsyms.c
··· 119 119 "kallsyms_markers", 120 120 "kallsyms_token_table", 121 121 "kallsyms_token_index", 122 + "kallsyms_seqs_of_names", 122 123 /* Exclude linker generated symbols which vary between passes */ 123 124 "_SDA_BASE_", /* ppc */ 124 125 "_SDA2_BASE_", /* ppc */
+4 -2
scripts/kconfig/confdata.c
··· 1226 1226 1227 1227 void conf_set_changed(bool val) 1228 1228 { 1229 - if (conf_changed_callback && conf_changed != val) 1230 - conf_changed_callback(); 1229 + bool changed = conf_changed != val; 1231 1230 1232 1231 conf_changed = val; 1232 + 1233 + if (conf_changed_callback && changed) 1234 + conf_changed_callback(); 1233 1235 } 1234 1236 1235 1237 bool conf_get_changed(void)
-1057
scripts/list-gitignored.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - // 3 - // Traverse the source tree, parsing all .gitignore files, and print file paths 4 - // that are ignored by git. 5 - // The output is suitable to the --exclude-from option of tar. 6 - // This is useful until the --exclude-vcs-ignores option gets working correctly. 7 - // 8 - // Copyright (C) 2023 Masahiro Yamada <masahiroy@kernel.org> 9 - // (a lot of code imported from GIT) 10 - 11 - #include <assert.h> 12 - #include <dirent.h> 13 - #include <errno.h> 14 - #include <fcntl.h> 15 - #include <getopt.h> 16 - #include <stdarg.h> 17 - #include <stdbool.h> 18 - #include <stdio.h> 19 - #include <stdlib.h> 20 - #include <string.h> 21 - #include <sys/stat.h> 22 - #include <sys/types.h> 23 - #include <unistd.h> 24 - 25 - // Imported from commit 23c56f7bd5f1667f8b793d796bf30e39545920f6 in GIT 26 - // 27 - //---------------------------(IMPORT FROM GIT BEGIN)--------------------------- 28 - 29 - // Copied from environment.c 30 - 31 - static bool ignore_case; 32 - 33 - // Copied from git-compat-util.h 34 - 35 - /* Sane ctype - no locale, and works with signed chars */ 36 - #undef isascii 37 - #undef isspace 38 - #undef isdigit 39 - #undef isalpha 40 - #undef isalnum 41 - #undef isprint 42 - #undef islower 43 - #undef isupper 44 - #undef tolower 45 - #undef toupper 46 - #undef iscntrl 47 - #undef ispunct 48 - #undef isxdigit 49 - 50 - static const unsigned char sane_ctype[256]; 51 - #define GIT_SPACE 0x01 52 - #define GIT_DIGIT 0x02 53 - #define GIT_ALPHA 0x04 54 - #define GIT_GLOB_SPECIAL 0x08 55 - #define GIT_REGEX_SPECIAL 0x10 56 - #define GIT_PATHSPEC_MAGIC 0x20 57 - #define GIT_CNTRL 0x40 58 - #define GIT_PUNCT 0x80 59 - #define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0) 60 - #define isascii(x) (((x) & ~0x7f) == 0) 61 - #define isspace(x) sane_istest(x,GIT_SPACE) 62 - #define isdigit(x) sane_istest(x,GIT_DIGIT) 63 - #define isalpha(x) sane_istest(x,GIT_ALPHA) 64 - #define isalnum(x) sane_istest(x,GIT_ALPHA | GIT_DIGIT) 65 - #define isprint(x) ((x) >= 0x20 && (x) <= 0x7e) 66 - #define islower(x) sane_iscase(x, 1) 67 - #define isupper(x) sane_iscase(x, 0) 68 - #define is_glob_special(x) sane_istest(x,GIT_GLOB_SPECIAL) 69 - #define iscntrl(x) (sane_istest(x,GIT_CNTRL)) 70 - #define ispunct(x) sane_istest(x, GIT_PUNCT | GIT_REGEX_SPECIAL | \ 71 - GIT_GLOB_SPECIAL | GIT_PATHSPEC_MAGIC) 72 - #define isxdigit(x) (hexval_table[(unsigned char)(x)] != -1) 73 - #define tolower(x) sane_case((unsigned char)(x), 0x20) 74 - #define toupper(x) sane_case((unsigned char)(x), 0) 75 - 76 - static inline int sane_case(int x, int high) 77 - { 78 - if (sane_istest(x, GIT_ALPHA)) 79 - x = (x & ~0x20) | high; 80 - return x; 81 - } 82 - 83 - static inline int sane_iscase(int x, int is_lower) 84 - { 85 - if (!sane_istest(x, GIT_ALPHA)) 86 - return 0; 87 - 88 - if (is_lower) 89 - return (x & 0x20) != 0; 90 - else 91 - return (x & 0x20) == 0; 92 - } 93 - 94 - // Copied from ctype.c 95 - 96 - enum { 97 - S = GIT_SPACE, 98 - A = GIT_ALPHA, 99 - D = GIT_DIGIT, 100 - G = GIT_GLOB_SPECIAL, /* *, ?, [, \\ */ 101 - R = GIT_REGEX_SPECIAL, /* $, (, ), +, ., ^, {, | */ 102 - P = GIT_PATHSPEC_MAGIC, /* other non-alnum, except for ] and } */ 103 - X = GIT_CNTRL, 104 - U = GIT_PUNCT, 105 - Z = GIT_CNTRL | GIT_SPACE 106 - }; 107 - 108 - static const unsigned char sane_ctype[256] = { 109 - X, X, X, X, X, X, X, X, X, Z, Z, X, X, Z, X, X, /* 0.. 15 */ 110 - X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, /* 16.. 31 */ 111 - S, P, P, P, R, P, P, P, R, R, G, R, P, P, R, P, /* 32.. 47 */ 112 - D, D, D, D, D, D, D, D, D, D, P, P, P, P, P, G, /* 48.. 63 */ 113 - P, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* 64.. 79 */ 114 - A, A, A, A, A, A, A, A, A, A, A, G, G, U, R, P, /* 80.. 95 */ 115 - P, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* 96..111 */ 116 - A, A, A, A, A, A, A, A, A, A, A, R, R, U, P, X, /* 112..127 */ 117 - /* Nothing in the 128.. range */ 118 - }; 119 - 120 - // Copied from hex.c 121 - 122 - static const signed char hexval_table[256] = { 123 - -1, -1, -1, -1, -1, -1, -1, -1, /* 00-07 */ 124 - -1, -1, -1, -1, -1, -1, -1, -1, /* 08-0f */ 125 - -1, -1, -1, -1, -1, -1, -1, -1, /* 10-17 */ 126 - -1, -1, -1, -1, -1, -1, -1, -1, /* 18-1f */ 127 - -1, -1, -1, -1, -1, -1, -1, -1, /* 20-27 */ 128 - -1, -1, -1, -1, -1, -1, -1, -1, /* 28-2f */ 129 - 0, 1, 2, 3, 4, 5, 6, 7, /* 30-37 */ 130 - 8, 9, -1, -1, -1, -1, -1, -1, /* 38-3f */ 131 - -1, 10, 11, 12, 13, 14, 15, -1, /* 40-47 */ 132 - -1, -1, -1, -1, -1, -1, -1, -1, /* 48-4f */ 133 - -1, -1, -1, -1, -1, -1, -1, -1, /* 50-57 */ 134 - -1, -1, -1, -1, -1, -1, -1, -1, /* 58-5f */ 135 - -1, 10, 11, 12, 13, 14, 15, -1, /* 60-67 */ 136 - -1, -1, -1, -1, -1, -1, -1, -1, /* 68-67 */ 137 - -1, -1, -1, -1, -1, -1, -1, -1, /* 70-77 */ 138 - -1, -1, -1, -1, -1, -1, -1, -1, /* 78-7f */ 139 - -1, -1, -1, -1, -1, -1, -1, -1, /* 80-87 */ 140 - -1, -1, -1, -1, -1, -1, -1, -1, /* 88-8f */ 141 - -1, -1, -1, -1, -1, -1, -1, -1, /* 90-97 */ 142 - -1, -1, -1, -1, -1, -1, -1, -1, /* 98-9f */ 143 - -1, -1, -1, -1, -1, -1, -1, -1, /* a0-a7 */ 144 - -1, -1, -1, -1, -1, -1, -1, -1, /* a8-af */ 145 - -1, -1, -1, -1, -1, -1, -1, -1, /* b0-b7 */ 146 - -1, -1, -1, -1, -1, -1, -1, -1, /* b8-bf */ 147 - -1, -1, -1, -1, -1, -1, -1, -1, /* c0-c7 */ 148 - -1, -1, -1, -1, -1, -1, -1, -1, /* c8-cf */ 149 - -1, -1, -1, -1, -1, -1, -1, -1, /* d0-d7 */ 150 - -1, -1, -1, -1, -1, -1, -1, -1, /* d8-df */ 151 - -1, -1, -1, -1, -1, -1, -1, -1, /* e0-e7 */ 152 - -1, -1, -1, -1, -1, -1, -1, -1, /* e8-ef */ 153 - -1, -1, -1, -1, -1, -1, -1, -1, /* f0-f7 */ 154 - -1, -1, -1, -1, -1, -1, -1, -1, /* f8-ff */ 155 - }; 156 - 157 - // Copied from wildmatch.h 158 - 159 - #define WM_CASEFOLD 1 160 - #define WM_PATHNAME 2 161 - 162 - #define WM_NOMATCH 1 163 - #define WM_MATCH 0 164 - #define WM_ABORT_ALL -1 165 - #define WM_ABORT_TO_STARSTAR -2 166 - 167 - // Copied from wildmatch.c 168 - 169 - typedef unsigned char uchar; 170 - 171 - // local modification: remove NEGATE_CLASS(2) 172 - 173 - #define CC_EQ(class, len, litmatch) ((len) == sizeof (litmatch)-1 \ 174 - && *(class) == *(litmatch) \ 175 - && strncmp((char*)class, litmatch, len) == 0) 176 - 177 - // local modification: simpilify macros 178 - #define ISBLANK(c) ((c) == ' ' || (c) == '\t') 179 - #define ISGRAPH(c) (isprint(c) && !isspace(c)) 180 - #define ISPRINT(c) isprint(c) 181 - #define ISDIGIT(c) isdigit(c) 182 - #define ISALNUM(c) isalnum(c) 183 - #define ISALPHA(c) isalpha(c) 184 - #define ISCNTRL(c) iscntrl(c) 185 - #define ISLOWER(c) islower(c) 186 - #define ISPUNCT(c) ispunct(c) 187 - #define ISSPACE(c) isspace(c) 188 - #define ISUPPER(c) isupper(c) 189 - #define ISXDIGIT(c) isxdigit(c) 190 - 191 - /* Match pattern "p" against "text" */ 192 - static int dowild(const uchar *p, const uchar *text, unsigned int flags) 193 - { 194 - uchar p_ch; 195 - const uchar *pattern = p; 196 - 197 - for ( ; (p_ch = *p) != '\0'; text++, p++) { 198 - int matched, match_slash, negated; 199 - uchar t_ch, prev_ch; 200 - if ((t_ch = *text) == '\0' && p_ch != '*') 201 - return WM_ABORT_ALL; 202 - if ((flags & WM_CASEFOLD) && ISUPPER(t_ch)) 203 - t_ch = tolower(t_ch); 204 - if ((flags & WM_CASEFOLD) && ISUPPER(p_ch)) 205 - p_ch = tolower(p_ch); 206 - switch (p_ch) { 207 - case '\\': 208 - /* Literal match with following character. Note that the test 209 - * in "default" handles the p[1] == '\0' failure case. */ 210 - p_ch = *++p; 211 - /* FALLTHROUGH */ 212 - default: 213 - if (t_ch != p_ch) 214 - return WM_NOMATCH; 215 - continue; 216 - case '?': 217 - /* Match anything but '/'. */ 218 - if ((flags & WM_PATHNAME) && t_ch == '/') 219 - return WM_NOMATCH; 220 - continue; 221 - case '*': 222 - if (*++p == '*') { 223 - const uchar *prev_p = p - 2; 224 - while (*++p == '*') {} 225 - if (!(flags & WM_PATHNAME)) 226 - /* without WM_PATHNAME, '*' == '**' */ 227 - match_slash = 1; 228 - else if ((prev_p < pattern || *prev_p == '/') && 229 - (*p == '\0' || *p == '/' || 230 - (p[0] == '\\' && p[1] == '/'))) { 231 - /* 232 - * Assuming we already match 'foo/' and are at 233 - * <star star slash>, just assume it matches 234 - * nothing and go ahead match the rest of the 235 - * pattern with the remaining string. This 236 - * helps make foo/<*><*>/bar (<> because 237 - * otherwise it breaks C comment syntax) match 238 - * both foo/bar and foo/a/bar. 239 - */ 240 - if (p[0] == '/' && 241 - dowild(p + 1, text, flags) == WM_MATCH) 242 - return WM_MATCH; 243 - match_slash = 1; 244 - } else /* WM_PATHNAME is set */ 245 - match_slash = 0; 246 - } else 247 - /* without WM_PATHNAME, '*' == '**' */ 248 - match_slash = flags & WM_PATHNAME ? 0 : 1; 249 - if (*p == '\0') { 250 - /* Trailing "**" matches everything. Trailing "*" matches 251 - * only if there are no more slash characters. */ 252 - if (!match_slash) { 253 - if (strchr((char *)text, '/')) 254 - return WM_NOMATCH; 255 - } 256 - return WM_MATCH; 257 - } else if (!match_slash && *p == '/') { 258 - /* 259 - * _one_ asterisk followed by a slash 260 - * with WM_PATHNAME matches the next 261 - * directory 262 - */ 263 - const char *slash = strchr((char*)text, '/'); 264 - if (!slash) 265 - return WM_NOMATCH; 266 - text = (const uchar*)slash; 267 - /* the slash is consumed by the top-level for loop */ 268 - break; 269 - } 270 - while (1) { 271 - if (t_ch == '\0') 272 - break; 273 - /* 274 - * Try to advance faster when an asterisk is 275 - * followed by a literal. We know in this case 276 - * that the string before the literal 277 - * must belong to "*". 278 - * If match_slash is false, do not look past 279 - * the first slash as it cannot belong to '*'. 280 - */ 281 - if (!is_glob_special(*p)) { 282 - p_ch = *p; 283 - if ((flags & WM_CASEFOLD) && ISUPPER(p_ch)) 284 - p_ch = tolower(p_ch); 285 - while ((t_ch = *text) != '\0' && 286 - (match_slash || t_ch != '/')) { 287 - if ((flags & WM_CASEFOLD) && ISUPPER(t_ch)) 288 - t_ch = tolower(t_ch); 289 - if (t_ch == p_ch) 290 - break; 291 - text++; 292 - } 293 - if (t_ch != p_ch) 294 - return WM_NOMATCH; 295 - } 296 - if ((matched = dowild(p, text, flags)) != WM_NOMATCH) { 297 - if (!match_slash || matched != WM_ABORT_TO_STARSTAR) 298 - return matched; 299 - } else if (!match_slash && t_ch == '/') 300 - return WM_ABORT_TO_STARSTAR; 301 - t_ch = *++text; 302 - } 303 - return WM_ABORT_ALL; 304 - case '[': 305 - p_ch = *++p; 306 - if (p_ch == '^') 307 - p_ch = '!'; 308 - /* Assign literal 1/0 because of "matched" comparison. */ 309 - negated = p_ch == '!' ? 1 : 0; 310 - if (negated) { 311 - /* Inverted character class. */ 312 - p_ch = *++p; 313 - } 314 - prev_ch = 0; 315 - matched = 0; 316 - do { 317 - if (!p_ch) 318 - return WM_ABORT_ALL; 319 - if (p_ch == '\\') { 320 - p_ch = *++p; 321 - if (!p_ch) 322 - return WM_ABORT_ALL; 323 - if (t_ch == p_ch) 324 - matched = 1; 325 - } else if (p_ch == '-' && prev_ch && p[1] && p[1] != ']') { 326 - p_ch = *++p; 327 - if (p_ch == '\\') { 328 - p_ch = *++p; 329 - if (!p_ch) 330 - return WM_ABORT_ALL; 331 - } 332 - if (t_ch <= p_ch && t_ch >= prev_ch) 333 - matched = 1; 334 - else if ((flags & WM_CASEFOLD) && ISLOWER(t_ch)) { 335 - uchar t_ch_upper = toupper(t_ch); 336 - if (t_ch_upper <= p_ch && t_ch_upper >= prev_ch) 337 - matched = 1; 338 - } 339 - p_ch = 0; /* This makes "prev_ch" get set to 0. */ 340 - } else if (p_ch == '[' && p[1] == ':') { 341 - const uchar *s; 342 - int i; 343 - for (s = p += 2; (p_ch = *p) && p_ch != ']'; p++) {} /*SHARED ITERATOR*/ 344 - if (!p_ch) 345 - return WM_ABORT_ALL; 346 - i = p - s - 1; 347 - if (i < 0 || p[-1] != ':') { 348 - /* Didn't find ":]", so treat like a normal set. */ 349 - p = s - 2; 350 - p_ch = '['; 351 - if (t_ch == p_ch) 352 - matched = 1; 353 - continue; 354 - } 355 - if (CC_EQ(s,i, "alnum")) { 356 - if (ISALNUM(t_ch)) 357 - matched = 1; 358 - } else if (CC_EQ(s,i, "alpha")) { 359 - if (ISALPHA(t_ch)) 360 - matched = 1; 361 - } else if (CC_EQ(s,i, "blank")) { 362 - if (ISBLANK(t_ch)) 363 - matched = 1; 364 - } else if (CC_EQ(s,i, "cntrl")) { 365 - if (ISCNTRL(t_ch)) 366 - matched = 1; 367 - } else if (CC_EQ(s,i, "digit")) { 368 - if (ISDIGIT(t_ch)) 369 - matched = 1; 370 - } else if (CC_EQ(s,i, "graph")) { 371 - if (ISGRAPH(t_ch)) 372 - matched = 1; 373 - } else if (CC_EQ(s,i, "lower")) { 374 - if (ISLOWER(t_ch)) 375 - matched = 1; 376 - } else if (CC_EQ(s,i, "print")) { 377 - if (ISPRINT(t_ch)) 378 - matched = 1; 379 - } else if (CC_EQ(s,i, "punct")) { 380 - if (ISPUNCT(t_ch)) 381 - matched = 1; 382 - } else if (CC_EQ(s,i, "space")) { 383 - if (ISSPACE(t_ch)) 384 - matched = 1; 385 - } else if (CC_EQ(s,i, "upper")) { 386 - if (ISUPPER(t_ch)) 387 - matched = 1; 388 - else if ((flags & WM_CASEFOLD) && ISLOWER(t_ch)) 389 - matched = 1; 390 - } else if (CC_EQ(s,i, "xdigit")) { 391 - if (ISXDIGIT(t_ch)) 392 - matched = 1; 393 - } else /* malformed [:class:] string */ 394 - return WM_ABORT_ALL; 395 - p_ch = 0; /* This makes "prev_ch" get set to 0. */ 396 - } else if (t_ch == p_ch) 397 - matched = 1; 398 - } while (prev_ch = p_ch, (p_ch = *++p) != ']'); 399 - if (matched == negated || 400 - ((flags & WM_PATHNAME) && t_ch == '/')) 401 - return WM_NOMATCH; 402 - continue; 403 - } 404 - } 405 - 406 - return *text ? WM_NOMATCH : WM_MATCH; 407 - } 408 - 409 - /* Match the "pattern" against the "text" string. */ 410 - static int wildmatch(const char *pattern, const char *text, unsigned int flags) 411 - { 412 - // local modification: move WM_CASEFOLD here 413 - if (ignore_case) 414 - flags |= WM_CASEFOLD; 415 - 416 - return dowild((const uchar*)pattern, (const uchar*)text, flags); 417 - } 418 - 419 - // Copied from dir.h 420 - 421 - #define PATTERN_FLAG_NODIR 1 422 - #define PATTERN_FLAG_ENDSWITH 4 423 - #define PATTERN_FLAG_MUSTBEDIR 8 424 - #define PATTERN_FLAG_NEGATIVE 16 425 - 426 - // Copied from dir.c 427 - 428 - static int fspathncmp(const char *a, const char *b, size_t count) 429 - { 430 - return ignore_case ? strncasecmp(a, b, count) : strncmp(a, b, count); 431 - } 432 - 433 - static int simple_length(const char *match) 434 - { 435 - int len = -1; 436 - 437 - for (;;) { 438 - unsigned char c = *match++; 439 - len++; 440 - if (c == '\0' || is_glob_special(c)) 441 - return len; 442 - } 443 - } 444 - 445 - static int no_wildcard(const char *string) 446 - { 447 - return string[simple_length(string)] == '\0'; 448 - } 449 - 450 - static void parse_path_pattern(const char **pattern, 451 - int *patternlen, 452 - unsigned *flags, 453 - int *nowildcardlen) 454 - { 455 - const char *p = *pattern; 456 - size_t i, len; 457 - 458 - *flags = 0; 459 - if (*p == '!') { 460 - *flags |= PATTERN_FLAG_NEGATIVE; 461 - p++; 462 - } 463 - len = strlen(p); 464 - if (len && p[len - 1] == '/') { 465 - len--; 466 - *flags |= PATTERN_FLAG_MUSTBEDIR; 467 - } 468 - for (i = 0; i < len; i++) { 469 - if (p[i] == '/') 470 - break; 471 - } 472 - if (i == len) 473 - *flags |= PATTERN_FLAG_NODIR; 474 - *nowildcardlen = simple_length(p); 475 - /* 476 - * we should have excluded the trailing slash from 'p' too, 477 - * but that's one more allocation. Instead just make sure 478 - * nowildcardlen does not exceed real patternlen 479 - */ 480 - if (*nowildcardlen > len) 481 - *nowildcardlen = len; 482 - if (*p == '*' && no_wildcard(p + 1)) 483 - *flags |= PATTERN_FLAG_ENDSWITH; 484 - *pattern = p; 485 - *patternlen = len; 486 - } 487 - 488 - static void trim_trailing_spaces(char *buf) 489 - { 490 - char *p, *last_space = NULL; 491 - 492 - for (p = buf; *p; p++) 493 - switch (*p) { 494 - case ' ': 495 - if (!last_space) 496 - last_space = p; 497 - break; 498 - case '\\': 499 - p++; 500 - if (!*p) 501 - return; 502 - /* fallthrough */ 503 - default: 504 - last_space = NULL; 505 - } 506 - 507 - if (last_space) 508 - *last_space = '\0'; 509 - } 510 - 511 - static int match_basename(const char *basename, int basenamelen, 512 - const char *pattern, int prefix, int patternlen, 513 - unsigned flags) 514 - { 515 - if (prefix == patternlen) { 516 - if (patternlen == basenamelen && 517 - !fspathncmp(pattern, basename, basenamelen)) 518 - return 1; 519 - } else if (flags & PATTERN_FLAG_ENDSWITH) { 520 - /* "*literal" matching against "fooliteral" */ 521 - if (patternlen - 1 <= basenamelen && 522 - !fspathncmp(pattern + 1, 523 - basename + basenamelen - (patternlen - 1), 524 - patternlen - 1)) 525 - return 1; 526 - } else { 527 - // local modification: call wildmatch() directly 528 - if (!wildmatch(pattern, basename, flags)) 529 - return 1; 530 - } 531 - return 0; 532 - } 533 - 534 - static int match_pathname(const char *pathname, int pathlen, 535 - const char *base, int baselen, 536 - const char *pattern, int prefix, int patternlen) 537 - { 538 - // local modification: remove local variables 539 - 540 - /* 541 - * match with FNM_PATHNAME; the pattern has base implicitly 542 - * in front of it. 543 - */ 544 - if (*pattern == '/') { 545 - pattern++; 546 - patternlen--; 547 - prefix--; 548 - } 549 - 550 - /* 551 - * baselen does not count the trailing slash. base[] may or 552 - * may not end with a trailing slash though. 553 - */ 554 - if (pathlen < baselen + 1 || 555 - (baselen && pathname[baselen] != '/') || 556 - fspathncmp(pathname, base, baselen)) 557 - return 0; 558 - 559 - // local modification: simplified because always baselen > 0 560 - pathname += baselen + 1; 561 - pathlen -= baselen + 1; 562 - 563 - if (prefix) { 564 - /* 565 - * if the non-wildcard part is longer than the 566 - * remaining pathname, surely it cannot match. 567 - */ 568 - if (prefix > pathlen) 569 - return 0; 570 - 571 - if (fspathncmp(pattern, pathname, prefix)) 572 - return 0; 573 - pattern += prefix; 574 - patternlen -= prefix; 575 - pathname += prefix; 576 - pathlen -= prefix; 577 - 578 - /* 579 - * If the whole pattern did not have a wildcard, 580 - * then our prefix match is all we need; we 581 - * do not need to call fnmatch at all. 582 - */ 583 - if (!patternlen && !pathlen) 584 - return 1; 585 - } 586 - 587 - // local modification: call wildmatch() directly 588 - return !wildmatch(pattern, pathname, WM_PATHNAME); 589 - } 590 - 591 - // Copied from git/utf8.c 592 - 593 - static const char utf8_bom[] = "\357\273\277"; 594 - 595 - //----------------------------(IMPORT FROM GIT END)---------------------------- 596 - 597 - struct pattern { 598 - unsigned int flags; 599 - int nowildcardlen; 600 - int patternlen; 601 - int dirlen; 602 - char pattern[]; 603 - }; 604 - 605 - static struct pattern **pattern_list; 606 - static int nr_patterns, alloced_patterns; 607 - 608 - // Remember the number of patterns at each directory level 609 - static int *nr_patterns_at; 610 - // Track the current/max directory level; 611 - static int depth, max_depth; 612 - static bool debug_on; 613 - static FILE *out_fp, *stat_fp; 614 - static char *prefix = ""; 615 - static char *progname; 616 - 617 - static void __attribute__((noreturn)) perror_exit(const char *s) 618 - { 619 - perror(s); 620 - 621 - exit(EXIT_FAILURE); 622 - } 623 - 624 - static void __attribute__((noreturn)) error_exit(const char *fmt, ...) 625 - { 626 - va_list args; 627 - 628 - fprintf(stderr, "%s: error: ", progname); 629 - 630 - va_start(args, fmt); 631 - vfprintf(stderr, fmt, args); 632 - va_end(args); 633 - 634 - exit(EXIT_FAILURE); 635 - } 636 - 637 - static void debug(const char *fmt, ...) 638 - { 639 - va_list args; 640 - int i; 641 - 642 - if (!debug_on) 643 - return; 644 - 645 - fprintf(stderr, "[DEBUG] "); 646 - 647 - for (i = 0; i < depth * 2; i++) 648 - fputc(' ', stderr); 649 - 650 - va_start(args, fmt); 651 - vfprintf(stderr, fmt, args); 652 - va_end(args); 653 - } 654 - 655 - static void *xrealloc(void *ptr, size_t size) 656 - { 657 - ptr = realloc(ptr, size); 658 - if (!ptr) 659 - perror_exit(progname); 660 - 661 - return ptr; 662 - } 663 - 664 - static void *xmalloc(size_t size) 665 - { 666 - return xrealloc(NULL, size); 667 - } 668 - 669 - // similar to last_matching_pattern_from_list() in GIT 670 - static bool is_ignored(const char *path, int pathlen, int dirlen, bool is_dir) 671 - { 672 - int i; 673 - 674 - // Search in the reverse order because the last matching pattern wins. 675 - for (i = nr_patterns - 1; i >= 0; i--) { 676 - struct pattern *p = pattern_list[i]; 677 - unsigned int flags = p->flags; 678 - const char *gitignore_dir = p->pattern + p->patternlen + 1; 679 - bool ignored; 680 - 681 - if ((flags & PATTERN_FLAG_MUSTBEDIR) && !is_dir) 682 - continue; 683 - 684 - if (flags & PATTERN_FLAG_NODIR) { 685 - if (!match_basename(path + dirlen + 1, 686 - pathlen - dirlen - 1, 687 - p->pattern, 688 - p->nowildcardlen, 689 - p->patternlen, 690 - p->flags)) 691 - continue; 692 - } else { 693 - if (!match_pathname(path, pathlen, 694 - gitignore_dir, p->dirlen, 695 - p->pattern, 696 - p->nowildcardlen, 697 - p->patternlen)) 698 - continue; 699 - } 700 - 701 - debug("%s: matches %s%s%s (%s/.gitignore)\n", path, 702 - flags & PATTERN_FLAG_NEGATIVE ? "!" : "", p->pattern, 703 - flags & PATTERN_FLAG_MUSTBEDIR ? "/" : "", 704 - gitignore_dir); 705 - 706 - ignored = (flags & PATTERN_FLAG_NEGATIVE) == 0; 707 - if (ignored) 708 - debug("Ignore: %s\n", path); 709 - 710 - return ignored; 711 - } 712 - 713 - debug("%s: no match\n", path); 714 - 715 - return false; 716 - } 717 - 718 - static void add_pattern(const char *string, const char *dir, int dirlen) 719 - { 720 - struct pattern *p; 721 - int patternlen, nowildcardlen; 722 - unsigned int flags; 723 - 724 - parse_path_pattern(&string, &patternlen, &flags, &nowildcardlen); 725 - 726 - if (patternlen == 0) 727 - return; 728 - 729 - p = xmalloc(sizeof(*p) + patternlen + dirlen + 2); 730 - 731 - memcpy(p->pattern, string, patternlen); 732 - p->pattern[patternlen] = 0; 733 - memcpy(p->pattern + patternlen + 1, dir, dirlen); 734 - p->pattern[patternlen + 1 + dirlen] = 0; 735 - 736 - p->patternlen = patternlen; 737 - p->nowildcardlen = nowildcardlen; 738 - p->dirlen = dirlen; 739 - p->flags = flags; 740 - 741 - debug("Add pattern: %s%s%s\n", 742 - flags & PATTERN_FLAG_NEGATIVE ? "!" : "", p->pattern, 743 - flags & PATTERN_FLAG_MUSTBEDIR ? "/" : ""); 744 - 745 - if (nr_patterns >= alloced_patterns) { 746 - alloced_patterns += 128; 747 - pattern_list = xrealloc(pattern_list, 748 - sizeof(*pattern_list) * alloced_patterns); 749 - } 750 - 751 - pattern_list[nr_patterns++] = p; 752 - } 753 - 754 - // similar to add_patterns_from_buffer() in GIT 755 - static void add_patterns_from_gitignore(const char *dir, int dirlen) 756 - { 757 - struct stat st; 758 - char path[PATH_MAX], *buf, *entry; 759 - size_t size; 760 - int fd, pathlen, i; 761 - 762 - pathlen = snprintf(path, sizeof(path), "%s/.gitignore", dir); 763 - if (pathlen >= sizeof(path)) 764 - error_exit("%s: too long path was truncated\n", path); 765 - 766 - fd = open(path, O_RDONLY | O_NOFOLLOW); 767 - if (fd < 0) { 768 - if (errno != ENOENT) 769 - return perror_exit(path); 770 - return; 771 - } 772 - 773 - if (fstat(fd, &st) < 0) 774 - perror_exit(path); 775 - 776 - size = st.st_size; 777 - 778 - buf = xmalloc(size + 1); 779 - if (read(fd, buf, st.st_size) != st.st_size) 780 - perror_exit(path); 781 - 782 - buf[st.st_size] = '\n'; 783 - if (close(fd)) 784 - perror_exit(path); 785 - 786 - debug("Parse %s\n", path); 787 - 788 - entry = buf; 789 - 790 - // skip utf8 bom 791 - if (!strncmp(entry, utf8_bom, strlen(utf8_bom))) 792 - entry += strlen(utf8_bom); 793 - 794 - for (i = entry - buf; i < size; i++) { 795 - if (buf[i] == '\n') { 796 - if (entry != buf + i && entry[0] != '#') { 797 - buf[i - (i && buf[i-1] == '\r')] = 0; 798 - trim_trailing_spaces(entry); 799 - add_pattern(entry, dir, dirlen); 800 - } 801 - entry = buf + i + 1; 802 - } 803 - } 804 - 805 - free(buf); 806 - } 807 - 808 - // Save the current number of patterns and increment the depth 809 - static void increment_depth(void) 810 - { 811 - if (depth >= max_depth) { 812 - max_depth += 1; 813 - nr_patterns_at = xrealloc(nr_patterns_at, 814 - sizeof(*nr_patterns_at) * max_depth); 815 - } 816 - 817 - nr_patterns_at[depth] = nr_patterns; 818 - depth++; 819 - } 820 - 821 - // Decrement the depth, and free up the patterns of this directory level. 822 - static void decrement_depth(void) 823 - { 824 - depth--; 825 - assert(depth >= 0); 826 - 827 - while (nr_patterns > nr_patterns_at[depth]) 828 - free(pattern_list[--nr_patterns]); 829 - } 830 - 831 - static void print_path(const char *path) 832 - { 833 - // The path always starts with "./" 834 - assert(strlen(path) >= 2); 835 - 836 - // Replace the root directory with a preferred prefix. 837 - // This is useful for the tar command. 838 - fprintf(out_fp, "%s%s\n", prefix, path + 2); 839 - } 840 - 841 - static void print_stat(const char *path, struct stat *st) 842 - { 843 - if (!stat_fp) 844 - return; 845 - 846 - if (!S_ISREG(st->st_mode) && !S_ISLNK(st->st_mode)) 847 - return; 848 - 849 - assert(strlen(path) >= 2); 850 - 851 - fprintf(stat_fp, "%c %9ld %10ld %s\n", 852 - S_ISLNK(st->st_mode) ? 'l' : '-', 853 - st->st_size, st->st_mtim.tv_sec, path + 2); 854 - } 855 - 856 - // Traverse the entire directory tree, parsing .gitignore files. 857 - // Print file paths that are not tracked by git. 858 - // 859 - // Return true if all files under the directory are ignored, false otherwise. 860 - static bool traverse_directory(const char *dir, int dirlen) 861 - { 862 - bool all_ignored = true; 863 - DIR *dirp; 864 - 865 - debug("Enter[%d]: %s\n", depth, dir); 866 - increment_depth(); 867 - 868 - add_patterns_from_gitignore(dir, dirlen); 869 - 870 - dirp = opendir(dir); 871 - if (!dirp) 872 - perror_exit(dir); 873 - 874 - while (1) { 875 - struct dirent *d; 876 - struct stat st; 877 - char path[PATH_MAX]; 878 - int pathlen; 879 - bool ignored; 880 - 881 - errno = 0; 882 - d = readdir(dirp); 883 - if (!d) { 884 - if (errno) 885 - perror_exit(dir); 886 - break; 887 - } 888 - 889 - if (!strcmp(d->d_name, "..") || !strcmp(d->d_name, ".")) 890 - continue; 891 - 892 - pathlen = snprintf(path, sizeof(path), "%s/%s", dir, d->d_name); 893 - if (pathlen >= sizeof(path)) 894 - error_exit("%s: too long path was truncated\n", path); 895 - 896 - if (lstat(path, &st) < 0) 897 - perror_exit(path); 898 - 899 - if ((!S_ISREG(st.st_mode) && !S_ISDIR(st.st_mode) && !S_ISLNK(st.st_mode)) || 900 - is_ignored(path, pathlen, dirlen, S_ISDIR(st.st_mode))) { 901 - ignored = true; 902 - } else { 903 - if (S_ISDIR(st.st_mode) && !S_ISLNK(st.st_mode)) 904 - // If all the files in a directory are ignored, 905 - // let's ignore that directory as well. This 906 - // will avoid empty directories in the tarball. 907 - ignored = traverse_directory(path, pathlen); 908 - else 909 - ignored = false; 910 - } 911 - 912 - if (ignored) { 913 - print_path(path); 914 - } else { 915 - print_stat(path, &st); 916 - all_ignored = false; 917 - } 918 - } 919 - 920 - if (closedir(dirp)) 921 - perror_exit(dir); 922 - 923 - decrement_depth(); 924 - debug("Leave[%d]: %s\n", depth, dir); 925 - 926 - return all_ignored; 927 - } 928 - 929 - static void usage(void) 930 - { 931 - fprintf(stderr, 932 - "usage: %s [options]\n" 933 - "\n" 934 - "Show files that are ignored by git\n" 935 - "\n" 936 - "options:\n" 937 - " -d, --debug print debug messages to stderr\n" 938 - " -e, --exclude PATTERN add the given exclude pattern\n" 939 - " -h, --help show this help message and exit\n" 940 - " -i, --ignore-case Ignore case differences between the patterns and the files\n" 941 - " -o, --output FILE output the ignored files to a file (default: '-', i.e. stdout)\n" 942 - " -p, --prefix PREFIX prefix added to each path (default: empty string)\n" 943 - " -r, --rootdir DIR root of the source tree (default: current working directory)\n" 944 - " -s, --stat FILE output the file stat of non-ignored files to a file\n", 945 - progname); 946 - } 947 - 948 - static void open_output(const char *pathname, FILE **fp) 949 - { 950 - if (strcmp(pathname, "-")) { 951 - *fp = fopen(pathname, "w"); 952 - if (!*fp) 953 - perror_exit(pathname); 954 - } else { 955 - *fp = stdout; 956 - } 957 - } 958 - 959 - static void close_output(const char *pathname, FILE *fp) 960 - { 961 - fflush(fp); 962 - 963 - if (ferror(fp)) 964 - error_exit("not all data was written to the output\n"); 965 - 966 - if (fclose(fp)) 967 - perror_exit(pathname); 968 - } 969 - 970 - int main(int argc, char *argv[]) 971 - { 972 - const char *output = "-"; 973 - const char *rootdir = "."; 974 - const char *stat = NULL; 975 - 976 - progname = strrchr(argv[0], '/'); 977 - if (progname) 978 - progname++; 979 - else 980 - progname = argv[0]; 981 - 982 - while (1) { 983 - static struct option long_options[] = { 984 - {"debug", no_argument, NULL, 'd'}, 985 - {"help", no_argument, NULL, 'h'}, 986 - {"ignore-case", no_argument, NULL, 'i'}, 987 - {"output", required_argument, NULL, 'o'}, 988 - {"prefix", required_argument, NULL, 'p'}, 989 - {"rootdir", required_argument, NULL, 'r'}, 990 - {"stat", required_argument, NULL, 's'}, 991 - {"exclude", required_argument, NULL, 'x'}, 992 - {}, 993 - }; 994 - 995 - int c = getopt_long(argc, argv, "dhino:p:r:s:x:", long_options, NULL); 996 - 997 - if (c == -1) 998 - break; 999 - 1000 - switch (c) { 1001 - case 'd': 1002 - debug_on = true; 1003 - break; 1004 - case 'h': 1005 - usage(); 1006 - exit(0); 1007 - case 'i': 1008 - ignore_case = true; 1009 - break; 1010 - case 'o': 1011 - output = optarg; 1012 - break; 1013 - case 'p': 1014 - prefix = optarg; 1015 - break; 1016 - case 'r': 1017 - rootdir = optarg; 1018 - break; 1019 - case 's': 1020 - stat = optarg; 1021 - break; 1022 - case 'x': 1023 - add_pattern(optarg, ".", strlen(".")); 1024 - break; 1025 - case '?': 1026 - usage(); 1027 - /* fallthrough */ 1028 - default: 1029 - exit(EXIT_FAILURE); 1030 - } 1031 - } 1032 - 1033 - open_output(output, &out_fp); 1034 - if (stat && stat[0]) 1035 - open_output(stat, &stat_fp); 1036 - 1037 - if (chdir(rootdir)) 1038 - perror_exit(rootdir); 1039 - 1040 - add_pattern(".git/", ".", strlen(".")); 1041 - 1042 - if (traverse_directory(".", strlen("."))) 1043 - print_path("./"); 1044 - 1045 - assert(depth == 0); 1046 - 1047 - while (nr_patterns > 0) 1048 - free(pattern_list[--nr_patterns]); 1049 - free(pattern_list); 1050 - free(nr_patterns_at); 1051 - 1052 - close_output(output, out_fp); 1053 - if (stat_fp) 1054 - close_output(stat, stat_fp); 1055 - 1056 - return 0; 1057 - }
+140 -125
scripts/package/builddeb
··· 51 51 dpkg-deb $dpkg_deb_opts ${KDEB_COMPRESS:+-Z$KDEB_COMPRESS} --build "$pdir" .. 52 52 } 53 53 54 - deploy_kernel_headers () { 54 + install_linux_image () { 55 + pdir=$1 56 + pname=$2 57 + 58 + rm -rf ${pdir} 59 + 60 + # Only some architectures with OF support have this target 61 + if is_enabled CONFIG_OF_EARLY_FLATTREE && [ -d "${srctree}/arch/${SRCARCH}/boot/dts" ]; then 62 + ${MAKE} -f ${srctree}/Makefile INSTALL_DTBS_PATH="${pdir}/usr/lib/linux-image-${KERNELRELEASE}" dtbs_install 63 + fi 64 + 65 + if is_enabled CONFIG_MODULES; then 66 + ${MAKE} -f ${srctree}/Makefile INSTALL_MOD_PATH="${pdir}" modules_install 67 + rm -f "${pdir}/lib/modules/${KERNELRELEASE}/build" 68 + rm -f "${pdir}/lib/modules/${KERNELRELEASE}/source" 69 + if [ "${SRCARCH}" = um ] ; then 70 + mkdir -p "${pdir}/usr/lib/uml/modules" 71 + mv "${pdir}/lib/modules/${KERNELRELEASE}" "${pdir}/usr/lib/uml/modules/${KERNELRELEASE}" 72 + fi 73 + fi 74 + 75 + # Install the kernel 76 + if [ "${ARCH}" = um ] ; then 77 + mkdir -p "${pdir}/usr/bin" "${pdir}/usr/share/doc/${pname}" 78 + cp System.map "${pdir}/usr/lib/uml/modules/${KERNELRELEASE}/System.map" 79 + cp ${KCONFIG_CONFIG} "${pdir}/usr/share/doc/${pname}/config" 80 + gzip "${pdir}/usr/share/doc/${pname}/config" 81 + else 82 + mkdir -p "${pdir}/boot" 83 + cp System.map "${pdir}/boot/System.map-${KERNELRELEASE}" 84 + cp ${KCONFIG_CONFIG} "${pdir}/boot/config-${KERNELRELEASE}" 85 + fi 86 + 87 + # Not all arches have the same installed path in debian 88 + # XXX: have each arch Makefile export a variable of the canonical image install 89 + # path instead 90 + case "${SRCARCH}" in 91 + um) 92 + installed_image_path="usr/bin/linux-${KERNELRELEASE}";; 93 + parisc|mips|powerpc) 94 + installed_image_path="boot/vmlinux-${KERNELRELEASE}";; 95 + *) 96 + installed_image_path="boot/vmlinuz-${KERNELRELEASE}";; 97 + esac 98 + cp "$(${MAKE} -s -f ${srctree}/Makefile image_name)" "${pdir}/${installed_image_path}" 99 + 100 + # Install the maintainer scripts 101 + # Note: hook scripts under /etc/kernel are also executed by official Debian 102 + # kernel packages, as well as kernel packages built using make-kpkg. 103 + # make-kpkg sets $INITRD to indicate whether an initramfs is wanted, and 104 + # so do we; recent versions of dracut and initramfs-tools will obey this. 105 + debhookdir=${KDEB_HOOKDIR:-/etc/kernel} 106 + for script in postinst postrm preinst prerm; do 107 + mkdir -p "${pdir}${debhookdir}/${script}.d" 108 + 109 + mkdir -p "${pdir}/DEBIAN" 110 + cat <<-EOF > "${pdir}/DEBIAN/${script}" 111 + 112 + #!/bin/sh 113 + 114 + set -e 115 + 116 + # Pass maintainer script parameters to hook scripts 117 + export DEB_MAINT_PARAMS="\$*" 118 + 119 + # Tell initramfs builder whether it's wanted 120 + export INITRD=$(if_enabled_echo CONFIG_BLK_DEV_INITRD Yes No) 121 + 122 + test -d ${debhookdir}/${script}.d && run-parts --arg="${KERNELRELEASE}" --arg="/${installed_image_path}" ${debhookdir}/${script}.d 123 + exit 0 124 + EOF 125 + chmod 755 "${pdir}/DEBIAN/${script}" 126 + done 127 + } 128 + 129 + install_linux_image_dbg () { 130 + pdir=$1 131 + image_pdir=$2 132 + 133 + rm -rf ${pdir} 134 + 135 + for module in $(find ${image_pdir}/lib/modules/ -name *.ko -printf '%P\n'); do 136 + module=lib/modules/${module} 137 + mkdir -p $(dirname ${pdir}/usr/lib/debug/${module}) 138 + # only keep debug symbols in the debug file 139 + ${OBJCOPY} --only-keep-debug ${image_pdir}/${module} ${pdir}/usr/lib/debug/${module} 140 + # strip original module from debug symbols 141 + ${OBJCOPY} --strip-debug ${image_pdir}/${module} 142 + # then add a link to those 143 + ${OBJCOPY} --add-gnu-debuglink=${pdir}/usr/lib/debug/${module} ${image_pdir}/${module} 144 + done 145 + 146 + # re-sign stripped modules 147 + if is_enabled CONFIG_MODULE_SIG_ALL; then 148 + ${MAKE} -f ${srctree}/Makefile INSTALL_MOD_PATH="${image_pdir}" modules_sign 149 + fi 150 + 151 + # Build debug package 152 + # Different tools want the image in different locations 153 + # perf 154 + mkdir -p ${pdir}/usr/lib/debug/lib/modules/${KERNELRELEASE}/ 155 + cp vmlinux ${pdir}/usr/lib/debug/lib/modules/${KERNELRELEASE}/ 156 + # systemtap 157 + mkdir -p ${pdir}/usr/lib/debug/boot/ 158 + ln -s ../lib/modules/${KERNELRELEASE}/vmlinux ${pdir}/usr/lib/debug/boot/vmlinux-${KERNELRELEASE} 159 + # kdump-tools 160 + ln -s lib/modules/${KERNELRELEASE}/vmlinux ${pdir}/usr/lib/debug/vmlinux-${KERNELRELEASE} 161 + } 162 + 163 + install_kernel_headers () { 55 164 pdir=$1 56 165 57 166 rm -rf $pdir ··· 198 89 ln -s /usr/src/linux-headers-$version $pdir/lib/modules/$version/build 199 90 } 200 91 201 - deploy_libc_headers () { 92 + install_libc_headers () { 202 93 pdir=$1 203 94 204 95 rm -rf $pdir ··· 213 104 mv $pdir/usr/include/asm $pdir/usr/include/$host_arch/ 214 105 } 215 106 216 - version=$KERNELRELEASE 217 - tmpdir=debian/linux-image 218 - dbg_dir=debian/linux-image-dbg 219 - packagename=linux-image-$version 220 - dbg_packagename=$packagename-dbg 107 + rm -f debian/files 221 108 222 - if [ "$ARCH" = "um" ] ; then 223 - packagename=user-mode-linux-$version 224 - fi 109 + packages_enabled=$(dh_listpackages) 225 110 226 - # Not all arches have the same installed path in debian 227 - # XXX: have each arch Makefile export a variable of the canonical image install 228 - # path instead 229 - case $ARCH in 230 - um) 231 - installed_image_path="usr/bin/linux-$version" 232 - ;; 233 - parisc|mips|powerpc) 234 - installed_image_path="boot/vmlinux-$version" 235 - ;; 236 - *) 237 - installed_image_path="boot/vmlinuz-$version" 238 - esac 239 - 240 - BUILD_DEBUG=$(if_enabled_echo CONFIG_DEBUG_INFO Yes) 241 - 242 - # Setup the directory structure 243 - rm -rf "$tmpdir" "$dbg_dir" debian/files 244 - mkdir -m 755 -p "$tmpdir/DEBIAN" 245 - mkdir -p "$tmpdir/lib" "$tmpdir/boot" 246 - 247 - # Install the kernel 248 - if [ "$ARCH" = "um" ] ; then 249 - mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" "$tmpdir/usr/share/doc/$packagename" 250 - cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map" 251 - cp $KCONFIG_CONFIG "$tmpdir/usr/share/doc/$packagename/config" 252 - gzip "$tmpdir/usr/share/doc/$packagename/config" 253 - else 254 - cp System.map "$tmpdir/boot/System.map-$version" 255 - cp $KCONFIG_CONFIG "$tmpdir/boot/config-$version" 256 - fi 257 - cp "$($MAKE -s -f $srctree/Makefile image_name)" "$tmpdir/$installed_image_path" 258 - 259 - if is_enabled CONFIG_OF_EARLY_FLATTREE; then 260 - # Only some architectures with OF support have this target 261 - if [ -d "${srctree}/arch/$SRCARCH/boot/dts" ]; then 262 - $MAKE -f $srctree/Makefile INSTALL_DTBS_PATH="$tmpdir/usr/lib/$packagename" dtbs_install 263 - fi 264 - fi 265 - 266 - if is_enabled CONFIG_MODULES; then 267 - INSTALL_MOD_PATH="$tmpdir" $MAKE -f $srctree/Makefile modules_install 268 - rm -f "$tmpdir/lib/modules/$version/build" 269 - rm -f "$tmpdir/lib/modules/$version/source" 270 - if [ "$ARCH" = "um" ] ; then 271 - mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/" 272 - rmdir "$tmpdir/lib/modules/$version" 273 - fi 274 - if [ -n "$BUILD_DEBUG" ] ; then 275 - for module in $(find $tmpdir/lib/modules/ -name *.ko -printf '%P\n'); do 276 - module=lib/modules/$module 277 - mkdir -p $(dirname $dbg_dir/usr/lib/debug/$module) 278 - # only keep debug symbols in the debug file 279 - $OBJCOPY --only-keep-debug $tmpdir/$module $dbg_dir/usr/lib/debug/$module 280 - # strip original module from debug symbols 281 - $OBJCOPY --strip-debug $tmpdir/$module 282 - # then add a link to those 283 - $OBJCOPY --add-gnu-debuglink=$dbg_dir/usr/lib/debug/$module $tmpdir/$module 284 - done 285 - 286 - # resign stripped modules 287 - if is_enabled CONFIG_MODULE_SIG_ALL; then 288 - INSTALL_MOD_PATH="$tmpdir" $MAKE -f $srctree/Makefile modules_sign 289 - fi 290 - fi 291 - fi 292 - 293 - # Install the maintainer scripts 294 - # Note: hook scripts under /etc/kernel are also executed by official Debian 295 - # kernel packages, as well as kernel packages built using make-kpkg. 296 - # make-kpkg sets $INITRD to indicate whether an initramfs is wanted, and 297 - # so do we; recent versions of dracut and initramfs-tools will obey this. 298 - debhookdir=${KDEB_HOOKDIR:-/etc/kernel} 299 - for script in postinst postrm preinst prerm ; do 300 - mkdir -p "$tmpdir$debhookdir/$script.d" 301 - cat <<EOF > "$tmpdir/DEBIAN/$script" 302 - #!/bin/sh 303 - 304 - set -e 305 - 306 - # Pass maintainer script parameters to hook scripts 307 - export DEB_MAINT_PARAMS="\$*" 308 - 309 - # Tell initramfs builder whether it's wanted 310 - export INITRD=$(if_enabled_echo CONFIG_BLK_DEV_INITRD Yes No) 311 - 312 - test -d $debhookdir/$script.d && run-parts --arg="$version" --arg="/$installed_image_path" $debhookdir/$script.d 313 - exit 0 314 - EOF 315 - chmod 755 "$tmpdir/DEBIAN/$script" 111 + for package in ${packages_enabled} 112 + do 113 + case ${package} in 114 + *-dbg) 115 + # This must be done after linux-image, that is, we expect the 116 + # debug package appears after linux-image in debian/control. 117 + install_linux_image_dbg debian/linux-image-dbg debian/linux-image;; 118 + linux-image-*|user-mode-linux-*) 119 + install_linux_image debian/linux-image ${package};; 120 + linux-libc-dev) 121 + install_libc_headers debian/linux-libc-dev;; 122 + linux-headers-*) 123 + install_kernel_headers debian/linux-headers;; 124 + esac 316 125 done 317 126 318 - if [ "$ARCH" != "um" ]; then 319 - if is_enabled CONFIG_MODULES; then 320 - deploy_kernel_headers debian/linux-headers 321 - create_package linux-headers-$version debian/linux-headers 322 - fi 323 - 324 - deploy_libc_headers debian/linux-libc-dev 325 - create_package linux-libc-dev debian/linux-libc-dev 326 - fi 327 - 328 - create_package "$packagename" "$tmpdir" 329 - 330 - if [ -n "$BUILD_DEBUG" ] ; then 331 - # Build debug package 332 - # Different tools want the image in different locations 333 - # perf 334 - mkdir -p $dbg_dir/usr/lib/debug/lib/modules/$version/ 335 - cp vmlinux $dbg_dir/usr/lib/debug/lib/modules/$version/ 336 - # systemtap 337 - mkdir -p $dbg_dir/usr/lib/debug/boot/ 338 - ln -s ../lib/modules/$version/vmlinux $dbg_dir/usr/lib/debug/boot/vmlinux-$version 339 - # kdump-tools 340 - ln -s lib/modules/$version/vmlinux $dbg_dir/usr/lib/debug/vmlinux-$version 341 - create_package "$dbg_packagename" "$dbg_dir" 342 - fi 127 + for package in ${packages_enabled} 128 + do 129 + case ${package} in 130 + *-dbg) 131 + create_package ${package} debian/linux-image-dbg;; 132 + linux-image-*|user-mode-linux-*) 133 + create_package ${package} debian/linux-image;; 134 + linux-libc-dev) 135 + create_package ${package} debian/linux-libc-dev;; 136 + linux-headers-*) 137 + create_package ${package} debian/linux-headers;; 138 + esac 139 + done 343 140 344 141 exit 0
+6 -8
scripts/package/deb-build-option
··· 1 1 #!/bin/sh 2 2 # SPDX-License-Identifier: GPL-2.0-only 3 3 4 - # Set up CROSS_COMPILE if we are cross-compiling, but not called from the 5 - # kernel toplevel Makefile 6 - if [ -z "${CROSS_COMPILE}${cross_compiling}" -a "${DEB_HOST_ARCH}" != "${DEB_BUILD_ARCH}" ]; then 4 + # Set up CROSS_COMPILE if not defined yet 5 + if [ "${CROSS_COMPILE+set}" != "set" -a "${DEB_HOST_ARCH}" != "${DEB_BUILD_ARCH}" ]; then 7 6 echo CROSS_COMPILE=${DEB_HOST_GNU_TYPE}- 8 7 fi 9 8 10 9 version=$(dpkg-parsechangelog -S Version) 11 - version_upstream="${version%-*}" 12 - debian_revision="${version#${version_upstream}}" 13 - debian_revision="${debian_revision#*-}" 10 + debian_revision="${version##*-}" 14 11 15 - echo KERNELRELEASE=${version_upstream} 16 - echo KBUILD_BUILD_VERSION=${debian_revision} 12 + if [ "${version}" != "${debian_revision}" ]; then 13 + echo KBUILD_BUILD_VERSION=${debian_revision} 14 + fi
+44
scripts/package/gen-diff-patch
··· 1 + #!/bin/sh 2 + # SPDX-License-Identifier: GPL-2.0-only 3 + 4 + diff_patch="${1}" 5 + untracked_patch="${2}" 6 + srctree=$(dirname $0)/../.. 7 + 8 + rm -f ${diff_patch} ${untracked_patch} 9 + 10 + if ! ${srctree}/scripts/check-git; then 11 + exit 12 + fi 13 + 14 + mkdir -p "$(dirname ${diff_patch})" "$(dirname ${untracked_patch})" 15 + 16 + git -C "${srctree}" diff HEAD > "${diff_patch}" 17 + 18 + if [ ! -s "${diff_patch}" ]; then 19 + rm -f "${diff_patch}" 20 + exit 21 + fi 22 + 23 + git -C ${srctree} status --porcelain --untracked-files=all | 24 + while read stat path 25 + do 26 + if [ "${stat}" = '??' ]; then 27 + 28 + if ! diff -u /dev/null "${srctree}/${path}" > .tmp_diff && 29 + ! head -n1 .tmp_diff | grep -q "Binary files"; then 30 + { 31 + echo "--- /dev/null" 32 + echo "+++ linux/$path" 33 + cat .tmp_diff | tail -n +3 34 + } >> ${untracked_patch} 35 + fi 36 + fi 37 + done 38 + 39 + rm -f .tmp_diff 40 + 41 + if [ ! -s "${diff_patch}" ]; then 42 + rm -f "${diff_patch}" 43 + exit 44 + fi
+20 -3
scripts/package/mkdebian
··· 91 91 if [ -n "$KDEB_PKGVERSION" ]; then 92 92 packageversion=$KDEB_PKGVERSION 93 93 else 94 - packageversion=$version-$($srctree/init/build-version) 94 + packageversion=$(${srctree}/scripts/setlocalversion --no-local ${srctree})-$($srctree/init/build-version) 95 95 fi 96 96 sourcename=${KDEB_SOURCENAME:-linux-upstream} 97 97 ··· 152 152 } > debian/patches/config 153 153 echo config > debian/patches/series 154 154 155 + $(dirname $0)/gen-diff-patch debian/patches/diff.patch debian/patches/untracked.patch 156 + if [ -f debian/patches/diff.patch ]; then 157 + echo diff.patch >> debian/patches/series 158 + fi 159 + if [ -f debian/patches/untracked.patch ]; then 160 + echo untracked.patch >> debian/patches/series 161 + fi 162 + 155 163 echo $debarch > debian/arch 156 164 extra_build_depends=", $(if_enabled_echo CONFIG_UNWINDER_ORC libelf-dev:native)" 157 165 extra_build_depends="$extra_build_depends, $(if_enabled_echo CONFIG_SYSTEM_TRUSTED_KEYRING libssl-dev:native)" ··· 200 192 Priority: optional 201 193 Maintainer: $maintainer 202 194 Rules-Requires-Root: no 203 - Build-Depends: bc, rsync, kmod, cpio, bison, flex $extra_build_depends 195 + Build-Depends: bc, debhelper, rsync, kmod, cpio, bison, flex $extra_build_depends 204 196 Homepage: https://www.kernel.org/ 205 197 206 198 Package: $packagename-$version ··· 208 200 Description: Linux kernel, version $version 209 201 This package contains the Linux kernel, modules and corresponding other 210 202 files, version: $version. 203 + EOF 204 + 205 + if [ "${SRCARCH}" != um ]; then 206 + cat <<EOF >> debian/control 211 207 212 208 Package: linux-libc-dev 213 209 Section: devel ··· 234 222 This is useful for people who need to build external modules 235 223 EOF 236 224 fi 225 + fi 237 226 238 227 if is_enabled CONFIG_DEBUG_INFO; then 239 228 cat <<EOF >> debian/control ··· 252 239 #!$(command -v $MAKE) -f 253 240 254 241 srctree ?= . 242 + KERNELRELEASE = ${KERNELRELEASE} 255 243 256 244 build-indep: 257 245 build-arch: 258 246 \$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} \ 247 + KERNELRELEASE=\$(KERNELRELEASE) \ 259 248 \$(shell \$(srctree)/scripts/package/deb-build-option) \ 260 249 olddefconfig all 261 250 ··· 265 250 266 251 binary-indep: 267 252 binary-arch: build-arch 268 - \$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} intdeb-pkg 253 + \$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} \ 254 + KERNELRELEASE=\$(KERNELRELEASE) intdeb-pkg 255 + 269 256 clean: 270 257 rm -rf debian/files debian/linux-* 271 258 \$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} clean
+18 -4
scripts/package/mkspec
··· 15 15 MAKE="$MAKE -f $srctree/Makefile" 16 16 else 17 17 S= 18 + 19 + mkdir -p rpmbuild/SOURCES 20 + cp linux.tar.gz rpmbuild/SOURCES 21 + cp "${KCONFIG_CONFIG}" rpmbuild/SOURCES/config 22 + $(dirname $0)/gen-diff-patch rpmbuild/SOURCES/diff.patch rpmbuild/SOURCES/untracked.patch 23 + touch rpmbuild/SOURCES/diff.patch rpmbuild/SOURCES/untracked.patch 18 24 fi 19 25 20 - if grep -q CONFIG_MODULES=y .config; then 26 + if grep -q CONFIG_MODULES=y include/config/auto.conf; then 21 27 M= 22 28 else 23 29 M=DEL 24 30 fi 25 31 26 - if grep -q CONFIG_DRM=y .config; then 32 + if grep -q CONFIG_DRM=y include/config/auto.conf; then 27 33 PROVIDES=kernel-drm 28 34 fi 29 35 ··· 54 48 Vendor: The Linux Community 55 49 URL: https://www.kernel.org 56 50 $S Source0: linux.tar.gz 57 - $S Source1: .config 51 + $S Source1: config 52 + $S Source2: diff.patch 53 + $S Source3: untracked.patch 58 54 Provides: $PROVIDES 59 55 $S BuildRequires: bc binutils bison dwarves 60 56 $S BuildRequires: (elfutils-libelf-devel or libelf-devel) flex ··· 93 85 $S$M 94 86 $S %prep 95 87 $S %setup -q -n linux 96 - $S cp %{SOURCE1} . 88 + $S cp %{SOURCE1} .config 89 + $S if [ -s %{SOURCE2} ]; then 90 + $S patch -p1 < %{SOURCE2} 91 + $S fi 92 + $S if [ -s %{SOURCE3} ]; then 93 + $S patch -p1 < %{SOURCE3} 94 + $S fi 97 95 $S 98 96 $S %build 99 97 $S $MAKE %{?_smp_mflags} KERNELRELEASE=$KERNELRELEASE KBUILD_BUILD_VERSION=%{release}
+34 -11
scripts/setlocalversion
··· 11 11 # 12 12 13 13 usage() { 14 - echo "Usage: $0 [srctree]" >&2 14 + echo "Usage: $0 [--no-local] [srctree]" >&2 15 15 exit 1 16 16 } 17 + 18 + no_local=false 19 + if test "$1" = "--no-local"; then 20 + no_local=true 21 + shift 22 + fi 17 23 18 24 srctree=. 19 25 if test $# -gt 0; then ··· 32 26 33 27 scm_version() 34 28 { 35 - local short 29 + local short=false 30 + local no_dirty=false 36 31 local tag 37 - short=false 32 + 33 + while [ $# -gt 0 ]; 34 + do 35 + case "$1" in 36 + --short) 37 + short=true;; 38 + --no-dirty) 39 + no_dirty=true;; 40 + esac 41 + shift 42 + done 38 43 39 44 cd "$srctree" 40 - if test "$1" = "--short"; then 41 - short=true 42 - fi 43 45 44 46 if test -n "$(git rev-parse --show-cdup 2>/dev/null)"; then 45 47 return ··· 89 75 printf '%s%s' -g "$(echo $head | cut -c1-12)" 90 76 fi 91 77 78 + if ${no_dirty}; then 79 + return 80 + fi 81 + 92 82 # Check for uncommitted changes. 93 83 # This script must avoid any write attempt to the source tree, which 94 84 # might be read-only. ··· 128 110 echo "$res" 129 111 } 130 112 131 - if ! test -e include/config/auto.conf; then 132 - echo "Error: kernelrelease not valid - run 'make prepare' to update it" >&2 133 - exit 1 134 - fi 135 - 136 113 if [ -z "${KERNELVERSION}" ]; then 137 114 echo "KERNELVERSION is not set" >&2 138 115 exit 1 ··· 137 124 file_localversion="$(collect_files localversion*)" 138 125 if test ! "$srctree" -ef .; then 139 126 file_localversion="${file_localversion}$(collect_files "$srctree"/localversion*)" 127 + fi 128 + 129 + if ${no_local}; then 130 + echo "${KERNELVERSION}$(scm_version --no-dirty)" 131 + exit 0 132 + fi 133 + 134 + if ! test -e include/config/auto.conf; then 135 + echo "Error: kernelrelease not valid - run 'make prepare' to update it" >&2 136 + exit 1 140 137 fi 141 138 142 139 # version string from CONFIG_LOCALVERSION
+6 -3
security/keys/request_key.c
··· 38 38 #ifdef CONFIG_KEYS_REQUEST_CACHE 39 39 struct task_struct *t = current; 40 40 41 - key_put(t->cached_requested_key); 42 - t->cached_requested_key = key_get(key); 43 - set_tsk_thread_flag(t, TIF_NOTIFY_RESUME); 41 + /* Do not cache key if it is a kernel thread */ 42 + if (!(t->flags & PF_KTHREAD)) { 43 + key_put(t->cached_requested_key); 44 + t->cached_requested_key = key_get(key); 45 + set_tsk_thread_flag(t, TIF_NOTIFY_RESUME); 46 + } 44 47 #endif 45 48 } 46 49
+8 -4
tools/bootconfig/test-bootconfig.sh
··· 87 87 88 88 echo "Max node number check" 89 89 90 - echo -n > $TEMPCONF 91 - for i in `seq 1 1024` ; do 92 - echo "node$i" >> $TEMPCONF 93 - done 90 + awk ' 91 + BEGIN { 92 + for (i = 0; i < 26; i += 1) 93 + printf("%c\n", 65 + i % 26) 94 + for (i = 26; i < 8192; i += 1) 95 + printf("%c%c%c\n", 65 + i % 26, 65 + (i / 26) % 26, 65 + (i / 26 / 26)) 96 + } 97 + ' > $TEMPCONF 94 98 xpass $BOOTCONF -a $TEMPCONF $INITRD 95 99 96 100 echo "badnode" >> $TEMPCONF
+2 -2
tools/lib/bpf/libbpf_internal.h
··· 20 20 /* make sure libbpf doesn't use kernel-only integer typedefs */ 21 21 #pragma GCC poison u8 u16 u32 u64 s8 s16 s32 s64 22 22 23 - /* prevent accidental re-addition of reallocarray()/strlcpy() */ 24 - #pragma GCC poison reallocarray strlcpy 23 + /* prevent accidental re-addition of reallocarray() */ 24 + #pragma GCC poison reallocarray 25 25 26 26 #include "libbpf.h" 27 27 #include "btf.h"
+3 -3
tools/net/ynl/lib/ynl.py
··· 200 200 if seq is None: 201 201 seq = random.randint(1, 1024) 202 202 nlmsg = struct.pack("HHII", nl_type, nl_flags, seq, 0) 203 - genlmsg = struct.pack("bbH", genl_cmd, genl_version, 0) 203 + genlmsg = struct.pack("BBH", genl_cmd, genl_version, 0) 204 204 return nlmsg + genlmsg 205 205 206 206 ··· 264 264 self.hdr = nl_msg.raw[0:4] 265 265 self.raw = nl_msg.raw[4:] 266 266 267 - self.genl_cmd, self.genl_version, _ = struct.unpack("bbH", self.hdr) 267 + self.genl_cmd, self.genl_version, _ = struct.unpack("BBH", self.hdr) 268 268 269 269 self.raw_attrs = NlAttrs(self.raw) 270 270 ··· 360 360 raw >>= 1 361 361 i += 1 362 362 else: 363 - value = enum['entries'][raw - i] 363 + value = enum.entries_by_val[raw - i].name 364 364 rsp[attr_spec['name']] = value 365 365 366 366 def _decode(self, attrs, space):
+1
tools/testing/selftests/bpf/progs/find_vma_fail1.c
··· 2 2 /* Copyright (c) 2021 Facebook */ 3 3 #include "vmlinux.h" 4 4 #include <bpf/bpf_helpers.h> 5 + #define vm_flags vm_start 5 6 6 7 char _license[] SEC("license") = "GPL"; 7 8
+4 -6
tools/testing/selftests/bpf/progs/test_deny_namespace.c
··· 5 5 #include <errno.h> 6 6 #include <linux/capability.h> 7 7 8 - struct kernel_cap_struct { 9 - __u64 val; 10 - } __attribute__((preserve_access_index)); 8 + typedef struct { unsigned long long val; } kernel_cap_t; 11 9 12 10 struct cred { 13 - struct kernel_cap_struct cap_effective; 11 + kernel_cap_t cap_effective; 14 12 } __attribute__((preserve_access_index)); 15 13 16 14 char _license[] SEC("license") = "GPL"; ··· 16 18 SEC("lsm.s/userns_create") 17 19 int BPF_PROG(test_userns_create, const struct cred *cred, int ret) 18 20 { 19 - struct kernel_cap_struct caps = cred->cap_effective; 20 - __u64 cap_mask = BIT_LL(CAP_SYS_ADMIN); 21 + kernel_cap_t caps = cred->cap_effective; 22 + __u64 cap_mask = 1ULL << CAP_SYS_ADMIN; 21 23 22 24 if (ret) 23 25 return 0;