linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] PCI: endpoint: Make pci_epf_ops in pci_epf_driver const
@ 2023-07-22 23:08 Lars-Peter Clausen
  2023-07-22 23:08 ` [PATCH 2/5] PCI: endpoint: pci-epf-mhi: Constify pci_epf_ops and pci_epf_event_ops Lars-Peter Clausen
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Lars-Peter Clausen @ 2023-07-22 23:08 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Krzysztof Wilczyński
  Cc: Manivannan Sadhasivam, Kishon Vijay Abraham I, Bjorn Helgaas,
	Jon Mason, Dave Jiang, Allen Hubbe, linux-pci, mhi, ntb,
	Lars-Peter Clausen

The pci_epf_ops struct contains a set of callbacks that are used by the
pci_epf_driver. The ops struct is never modified by the epf core itself.

Marking the ops pointer const allows epf drivers to declare their
pci_epf_ops struct to be const. This allows the struct to be placed in the
read-only section. Which for example brings some security benefits as the
callbacks can not be overwritten.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 include/linux/pci-epf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h
index 3f44b6aec477..34be3f1da46c 100644
--- a/include/linux/pci-epf.h
+++ b/include/linux/pci-epf.h
@@ -98,7 +98,7 @@ struct pci_epf_driver {
 	void	(*remove)(struct pci_epf *epf);
 
 	struct device_driver	driver;
-	struct pci_epf_ops	*ops;
+	const struct pci_epf_ops *ops;
 	struct module		*owner;
 	struct list_head	epf_group;
 	const struct pci_epf_device_id	*id_table;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-12-18 22:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-22 23:08 [PATCH 1/5] PCI: endpoint: Make pci_epf_ops in pci_epf_driver const Lars-Peter Clausen
2023-07-22 23:08 ` [PATCH 2/5] PCI: endpoint: pci-epf-mhi: Constify pci_epf_ops and pci_epf_event_ops Lars-Peter Clausen
2023-07-24  6:01   ` Manivannan Sadhasivam
2023-07-22 23:08 ` [PATCH 3/5] PCI: endpoint: pci-epf-ntb: Constify pci_epf_ops Lars-Peter Clausen
2023-07-24  6:02   ` Manivannan Sadhasivam
2023-07-22 23:08 ` [PATCH 4/5] PCI: endpoint: pci-epf-vntb: " Lars-Peter Clausen
2023-07-24  6:02   ` Manivannan Sadhasivam
2023-07-22 23:08 ` [PATCH 5/5] PCI: endpoint: pci-epf-test: " Lars-Peter Clausen
2023-07-24  6:03   ` Manivannan Sadhasivam
2023-07-24  6:00 ` [PATCH 1/5] PCI: endpoint: Make pci_epf_ops in pci_epf_driver const Manivannan Sadhasivam
2023-12-18 22:43 ` Krzysztof Wilczyński

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).