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

Configure Feed

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

Merge branch 'ptp-ocp-a-fix-and-refactoring'

Andy Shevchenko says:

====================
ptp: ocp: A fix and refactoring

Here is the fix for incorrect use of %ptT with the associated
refactoring and additional cleanups.

Note, %ptS, which is introduced in another series that is already
applied to PRINTK tree, doesn't fit here, that's why this fix
is separated from that series.
====================

Link: https://patch.msgid.link/20251124084816.205035-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+18 -28
+18 -28
drivers/ptp/ptp_ocp.c
··· 25 25 #include <linux/crc16.h> 26 26 #include <linux/dpll.h> 27 27 28 - #define PCI_VENDOR_ID_FACEBOOK 0x1d9b 29 - #define PCI_DEVICE_ID_FACEBOOK_TIMECARD 0x0400 28 + #define PCI_DEVICE_ID_META_TIMECARD 0x0400 30 29 31 30 #define PCI_VENDOR_ID_CELESTICA 0x18d4 32 31 #define PCI_DEVICE_ID_CELESTICA_TIMECARD 0x1008 ··· 1029 1030 }; 1030 1031 1031 1032 static const struct pci_device_id ptp_ocp_pcidev_id[] = { 1032 - { PCI_DEVICE_DATA(FACEBOOK, TIMECARD, &ocp_fb_resource) }, 1033 + { PCI_DEVICE_DATA(META, TIMECARD, &ocp_fb_resource) }, 1033 1034 { PCI_DEVICE_DATA(CELESTICA, TIMECARD, &ocp_fb_resource) }, 1034 1035 { PCI_DEVICE_DATA(OROLIA, ARTCARD, &ocp_art_resource) }, 1035 1036 { PCI_DEVICE_DATA(ADVA, TIMECARD, &ocp_adva_resource) }, ··· 2224 2225 static void 2225 2226 ptp_ocp_unregister_ext(struct ptp_ocp_ext_src *ext) 2226 2227 { 2228 + if (!ext) 2229 + return; 2230 + 2227 2231 ext->info->enable(ext, ~0, false); 2228 2232 pci_free_irq(ext->bp->pdev, ext->irq_vec, ext); 2229 2233 kfree(ext); ··· 3252 3250 struct dev_ext_attribute *ea = to_ext_attr(attr); 3253 3251 struct ptp_ocp *bp = dev_get_drvdata(dev); 3254 3252 struct ptp_ocp_signal *signal; 3253 + int gen = (uintptr_t)ea->var; 3255 3254 struct timespec64 ts; 3256 - ssize_t count; 3257 - int i; 3258 3255 3259 - i = (uintptr_t)ea->var; 3260 - signal = &bp->signal[i]; 3261 - 3262 - count = sysfs_emit(buf, "%llu %d %llu %d", signal->period, 3263 - signal->duty, signal->phase, signal->polarity); 3256 + signal = &bp->signal[gen]; 3264 3257 3265 3258 ts = ktime_to_timespec64(signal->start); 3266 - count += sysfs_emit_at(buf, count, " %ptT TAI\n", &ts); 3267 3259 3268 - return count; 3260 + return sysfs_emit(buf, "%llu %d %llu %d %ptT TAI\n", 3261 + signal->period, signal->duty, signal->phase, signal->polarity, 3262 + &ts.tv_sec); 3269 3263 } 3270 3264 static EXT_ATTR_RW(signal, signal, 0); 3271 3265 static EXT_ATTR_RW(signal, signal, 1); ··· 4560 4562 ptp_ocp_detach_sysfs(bp); 4561 4563 ptp_ocp_attr_group_del(bp); 4562 4564 timer_delete_sync(&bp->watchdog); 4563 - if (bp->ts0) 4564 - ptp_ocp_unregister_ext(bp->ts0); 4565 - if (bp->ts1) 4566 - ptp_ocp_unregister_ext(bp->ts1); 4567 - if (bp->ts2) 4568 - ptp_ocp_unregister_ext(bp->ts2); 4569 - if (bp->ts3) 4570 - ptp_ocp_unregister_ext(bp->ts3); 4571 - if (bp->ts4) 4572 - ptp_ocp_unregister_ext(bp->ts4); 4573 - if (bp->pps) 4574 - ptp_ocp_unregister_ext(bp->pps); 4565 + ptp_ocp_unregister_ext(bp->ts0); 4566 + ptp_ocp_unregister_ext(bp->ts1); 4567 + ptp_ocp_unregister_ext(bp->ts2); 4568 + ptp_ocp_unregister_ext(bp->ts3); 4569 + ptp_ocp_unregister_ext(bp->ts4); 4570 + ptp_ocp_unregister_ext(bp->pps); 4575 4571 for (i = 0; i < 4; i++) 4576 - if (bp->signal_out[i]) 4577 - ptp_ocp_unregister_ext(bp->signal_out[i]); 4572 + ptp_ocp_unregister_ext(bp->signal_out[i]); 4578 4573 for (i = 0; i < __PORT_COUNT; i++) 4579 4574 if (bp->port[i].line != -1) 4580 4575 serial8250_unregister_port(bp->port[i].line); ··· 4820 4829 4821 4830 return 0; 4822 4831 out_dpll: 4823 - while (i) { 4824 - --i; 4832 + while (i--) { 4825 4833 dpll_pin_unregister(bp->dpll, bp->sma[i].dpll_pin, &dpll_pins_ops, &bp->sma[i]); 4826 4834 dpll_pin_put(bp->sma[i].dpll_pin); 4827 4835 }