@mytechtoday/augment-extensions 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/augment-extensions/coding-standards/c/CHANGELOG.md +55 -0
- package/augment-extensions/coding-standards/c/LICENSE +22 -0
- package/augment-extensions/coding-standards/c/README.md +167 -0
- package/augment-extensions/coding-standards/c/config/defaults.json +26 -0
- package/augment-extensions/coding-standards/c/config/examples/embedded.yaml +25 -0
- package/augment-extensions/coding-standards/c/config/examples/systems.json +31 -0
- package/augment-extensions/coding-standards/c/config/schema.json +244 -0
- package/augment-extensions/coding-standards/c/docs/API.md +613 -0
- package/augment-extensions/coding-standards/c/docs/CONFIGURATION.md +259 -0
- package/augment-extensions/coding-standards/c/docs/USER_GUIDE.md +567 -0
- package/augment-extensions/coding-standards/c/examples/drivers/Makefile +33 -0
- package/augment-extensions/coding-standards/c/examples/drivers/README.md +192 -0
- package/augment-extensions/coding-standards/c/examples/drivers/dma-example.c +224 -0
- package/augment-extensions/coding-standards/c/examples/drivers/example.dts +64 -0
- package/augment-extensions/coding-standards/c/examples/drivers/platform-driver.c +174 -0
- package/augment-extensions/coding-standards/c/examples/embedded/README.md +167 -0
- package/augment-extensions/coding-standards/c/examples/embedded/gpio-control.c +172 -0
- package/augment-extensions/coding-standards/c/examples/embedded/timer-isr.c +198 -0
- package/augment-extensions/coding-standards/c/examples/embedded/uart-communication.c +212 -0
- package/augment-extensions/coding-standards/c/examples/kernel/Makefile +82 -0
- package/augment-extensions/coding-standards/c/examples/kernel/README.md +168 -0
- package/augment-extensions/coding-standards/c/examples/kernel/char-device.c +198 -0
- package/augment-extensions/coding-standards/c/examples/kernel/proc-file.c +131 -0
- package/augment-extensions/coding-standards/c/examples/kernel/simple-module.c +111 -0
- package/augment-extensions/coding-standards/c/examples/legacy/Makefile +62 -0
- package/augment-extensions/coding-standards/c/examples/legacy/README.md +255 -0
- package/augment-extensions/coding-standards/c/examples/legacy/c89-to-c11-migration.c +268 -0
- package/augment-extensions/coding-standards/c/examples/legacy/compatibility-layer.c +239 -0
- package/augment-extensions/coding-standards/c/examples/networking/Makefile +35 -0
- package/augment-extensions/coding-standards/c/examples/networking/README.md +207 -0
- package/augment-extensions/coding-standards/c/examples/networking/protocol-parser.c +270 -0
- package/augment-extensions/coding-standards/c/examples/networking/tcp-server.c +197 -0
- package/augment-extensions/coding-standards/c/examples/networking/udp-multicast.c +220 -0
- package/augment-extensions/coding-standards/c/examples/realtime/Makefile +53 -0
- package/augment-extensions/coding-standards/c/examples/realtime/README.md +199 -0
- package/augment-extensions/coding-standards/c/examples/realtime/deadline-monitoring.c +260 -0
- package/augment-extensions/coding-standards/c/examples/realtime/priority-scheduling.c +258 -0
- package/augment-extensions/coding-standards/c/examples/systems/Makefile +34 -0
- package/augment-extensions/coding-standards/c/examples/systems/README.md +123 -0
- package/augment-extensions/coding-standards/c/examples/systems/ipc-pipes.c +181 -0
- package/augment-extensions/coding-standards/c/examples/systems/process-management.c +153 -0
- package/augment-extensions/coding-standards/c/examples/systems/signal-handling.c +162 -0
- package/augment-extensions/coding-standards/c/module.json +149 -0
- package/augment-extensions/coding-standards/c/rules/categories/drivers.md +635 -0
- package/augment-extensions/coding-standards/c/rules/categories/embedded.md +510 -0
- package/augment-extensions/coding-standards/c/rules/categories/kernel.md +653 -0
- package/augment-extensions/coding-standards/c/rules/categories/legacy.md +526 -0
- package/augment-extensions/coding-standards/c/rules/categories/networking.md +735 -0
- package/augment-extensions/coding-standards/c/rules/categories/realtime.md +631 -0
- package/augment-extensions/coding-standards/c/rules/categories/systems.md +586 -0
- package/augment-extensions/coding-standards/c/rules/universal/const-correctness.md +275 -0
- package/augment-extensions/coding-standards/c/rules/universal/documentation.md +251 -0
- package/augment-extensions/coding-standards/c/rules/universal/error-handling.md +250 -0
- package/augment-extensions/coding-standards/c/rules/universal/header-guards.md +254 -0
- package/augment-extensions/coding-standards/c/rules/universal/memory-safety.md +233 -0
- package/augment-extensions/coding-standards/c/rules/universal/naming.md +146 -0
- package/augment-extensions/coding-standards/c/src/conflict-detector.ts +461 -0
- package/augment-extensions/coding-standards/c/src/prompt-generator.ts +307 -0
- package/augment-extensions/coding-standards/c/src/rule-evaluator.ts +307 -0
- package/augment-extensions/coding-standards/c/src/rule-override.ts +427 -0
- package/augment-extensions/coding-standards/c/src/template-engine.ts +217 -0
- package/augment-extensions/coding-standards/c/templates/prompts/drivers.txt +191 -0
- package/augment-extensions/coding-standards/c/templates/prompts/embedded.txt +164 -0
- package/augment-extensions/coding-standards/c/templates/prompts/kernel.txt +175 -0
- package/augment-extensions/coding-standards/c/templates/prompts/legacy.txt +280 -0
- package/augment-extensions/coding-standards/c/templates/prompts/networking.txt +259 -0
- package/augment-extensions/coding-standards/c/templates/prompts/realtime.txt +219 -0
- package/augment-extensions/coding-standards/c/templates/prompts/systems.txt +147 -0
- package/augment-extensions/coding-standards/c/tests/integration/category-specific.test.ts +356 -0
- package/augment-extensions/coding-standards/c/tests/integration/end-to-end-workflow.test.ts +377 -0
- package/augment-extensions/coding-standards/c/tests/performance/benchmarks.test.ts +407 -0
- package/augment-extensions/coding-standards/c/tests/unit/config-manager.test.ts +345 -0
- package/augment-extensions/coding-standards/c/tests/unit/conflict-detector.test.ts +294 -0
- package/augment-extensions/coding-standards/c/tests/unit/prompt-generator.test.ts +174 -0
- package/augment-extensions/coding-standards/c/tests/unit/registry.test.ts +313 -0
- package/augment-extensions/coding-standards/c/tests/unit/rule-evaluator.test.ts +318 -0
- package/augment-extensions/coding-standards/c/tests/unit/rule-override.test.ts +326 -0
- package/augment-extensions/coding-standards/c/tests/unit/template-engine.test.ts +314 -0
- package/augment-extensions/coding-standards/go/CHARACTER-COUNT-REPORT.md +135 -0
- package/augment-extensions/coding-standards/go/PHASE1-COMPLETION.md +146 -0
- package/augment-extensions/coding-standards/go/PHASE4-COMPLETION.md +184 -0
- package/augment-extensions/coding-standards/go/README.md +200 -0
- package/augment-extensions/coding-standards/go/VALIDATION-CHECKLIST.md +154 -0
- package/augment-extensions/coding-standards/go/config/examples/example-cli.json +15 -0
- package/augment-extensions/coding-standards/go/config/examples/example-microservices.json +21 -0
- package/augment-extensions/coding-standards/go/config/examples/example-multi-category.yaml +24 -0
- package/augment-extensions/coding-standards/go/config/examples/example-web.json +15 -0
- package/augment-extensions/coding-standards/go/config/schema.json +110 -0
- package/augment-extensions/coding-standards/go/docs/CATEGORIES.md +221 -0
- package/augment-extensions/coding-standards/go/docs/CONFIGURATION.md +198 -0
- package/augment-extensions/coding-standards/go/docs/TROUBLESHOOTING.md +285 -0
- package/augment-extensions/coding-standards/go/examples/cli/cobra-app.go +287 -0
- package/augment-extensions/coding-standards/go/examples/cloud-native-app.go +217 -0
- package/augment-extensions/coding-standards/go/examples/devops-tool.go +250 -0
- package/augment-extensions/coding-standards/go/examples/distributed-system.go +247 -0
- package/augment-extensions/coding-standards/go/examples/microservices/grpc-service.go +253 -0
- package/augment-extensions/coding-standards/go/examples/rest-api.go +270 -0
- package/augment-extensions/coding-standards/go/examples/web/http-server.go +224 -0
- package/augment-extensions/coding-standards/go/module.json +139 -0
- package/augment-extensions/coding-standards/go/rules/categories/api-development/api-versioning.md +149 -0
- package/augment-extensions/coding-standards/go/rules/categories/api-development/rate-limiting.md +209 -0
- package/augment-extensions/coding-standards/go/rules/categories/api-development/rest-api-design.md +183 -0
- package/augment-extensions/coding-standards/go/rules/categories/cloud-native/cloud-config.md +193 -0
- package/augment-extensions/coding-standards/go/rules/categories/cloud-native/health-checks.md +231 -0
- package/augment-extensions/coding-standards/go/rules/categories/cloud-native/kubernetes.md +180 -0
- package/augment-extensions/coding-standards/go/rules/categories/devops-tooling/automation.md +179 -0
- package/augment-extensions/coding-standards/go/rules/categories/devops-tooling/ci-cd-integration.md +147 -0
- package/augment-extensions/coding-standards/go/rules/categories/devops-tooling/infrastructure-as-code.md +231 -0
- package/augment-extensions/coding-standards/go/rules/categories/distributed-systems/caching.md +150 -0
- package/augment-extensions/coding-standards/go/rules/categories/distributed-systems/consensus.md +187 -0
- package/augment-extensions/coding-standards/go/rules/categories/distributed-systems/event-sourcing.md +246 -0
- package/augment-extensions/coding-standards/go/rules/cli/command-parsing.md +264 -0
- package/augment-extensions/coding-standards/go/rules/cli/configuration.md +268 -0
- package/augment-extensions/coding-standards/go/rules/cli/cross-platform.md +324 -0
- package/augment-extensions/coding-standards/go/rules/microservices/distributed-tracing.md +253 -0
- package/augment-extensions/coding-standards/go/rules/microservices/grpc.md +257 -0
- package/augment-extensions/coding-standards/go/rules/microservices/metrics.md +278 -0
- package/augment-extensions/coding-standards/go/rules/microservices/service-discovery.md +249 -0
- package/augment-extensions/coding-standards/go/rules/universal/code-organization.md +221 -0
- package/augment-extensions/coding-standards/go/rules/universal/documentation.md +269 -0
- package/augment-extensions/coding-standards/go/rules/universal/performance.md +323 -0
- package/augment-extensions/coding-standards/go/rules/universal/testing.md +162 -0
- package/augment-extensions/coding-standards/go/rules/web/graceful-shutdown.md +249 -0
- package/augment-extensions/coding-standards/go/rules/web/http-handlers.md +164 -0
- package/augment-extensions/coding-standards/go/rules/web/middleware.md +234 -0
- package/augment-extensions/coding-standards/go/rules/web/routing.md +251 -0
- package/augment-extensions/coding-standards/go/templates/prompts/api.md +160 -0
- package/augment-extensions/coding-standards/go/templates/prompts/cli.md +225 -0
- package/augment-extensions/coding-standards/go/templates/prompts/cloud-native.md +121 -0
- package/augment-extensions/coding-standards/go/templates/prompts/devops.md +146 -0
- package/augment-extensions/coding-standards/go/templates/prompts/distributed.md +133 -0
- package/augment-extensions/coding-standards/go/templates/prompts/microservices.md +225 -0
- package/augment-extensions/coding-standards/go/templates/prompts/web.md +181 -0
- package/augment-extensions/coding-standards/go/tests/integration/module-integration.test.ts +164 -0
- package/augment-extensions/coding-standards/go/tests/unit/category-selection.test.ts +147 -0
- package/augment-extensions/coding-standards/go/tests/unit/module-structure.test.ts +154 -0
- package/augment-extensions/coding-standards/go/tests/validate-character-count.ps1 +13 -0
- package/augment-extensions/coding-standards/go/tests/validate-examples.ps1 +148 -0
- package/augment-extensions/coding-standards/go/tests/validate-examples.sh +135 -0
- package/cli/dist/analysis/ast-parser.d.ts +47 -0
- package/cli/dist/analysis/ast-parser.d.ts.map +1 -0
- package/cli/dist/analysis/ast-parser.js +161 -0
- package/cli/dist/analysis/ast-parser.js.map +1 -0
- package/cli/dist/analysis/complexity-analyzer.d.ts +27 -0
- package/cli/dist/analysis/complexity-analyzer.d.ts.map +1 -0
- package/cli/dist/analysis/complexity-analyzer.js +189 -0
- package/cli/dist/analysis/complexity-analyzer.js.map +1 -0
- package/cli/dist/analysis/dependency-analyzer.d.ts +23 -0
- package/cli/dist/analysis/dependency-analyzer.d.ts.map +1 -0
- package/cli/dist/analysis/dependency-analyzer.js +237 -0
- package/cli/dist/analysis/dependency-analyzer.js.map +1 -0
- package/cli/dist/analysis/index.d.ts +9 -0
- package/cli/dist/analysis/index.d.ts.map +1 -0
- package/cli/dist/analysis/index.js +25 -0
- package/cli/dist/analysis/index.js.map +1 -0
- package/cli/dist/analysis/security-scanner.d.ts +11 -0
- package/cli/dist/analysis/security-scanner.d.ts.map +1 -0
- package/cli/dist/analysis/security-scanner.js +294 -0
- package/cli/dist/analysis/security-scanner.js.map +1 -0
- package/cli/dist/analysis/types.d.ts +151 -0
- package/cli/dist/analysis/types.d.ts.map +1 -0
- package/cli/dist/analysis/types.js +6 -0
- package/cli/dist/analysis/types.js.map +1 -0
- package/cli/dist/cli.js +24 -0
- package/cli/dist/cli.js.map +1 -1
- package/cli/dist/commands/code-analysis.d.ts +11 -0
- package/cli/dist/commands/code-analysis.d.ts.map +1 -0
- package/cli/dist/commands/code-analysis.js +412 -0
- package/cli/dist/commands/code-analysis.js.map +1 -0
- package/modules.md +99 -3
- package/package.json +14 -2
- package/cli/dist/commands/agent.d.ts +0 -37
- package/cli/dist/commands/agent.d.ts.map +0 -1
- package/cli/dist/commands/agent.js +0 -222
- package/cli/dist/commands/agent.js.map +0 -1
- package/cli/dist/commands/beads.d.ts +0 -64
- package/cli/dist/commands/beads.d.ts.map +0 -1
- package/cli/dist/commands/beads.js +0 -377
- package/cli/dist/commands/beads.js.map +0 -1
- package/cli/dist/commands/change.d.ts +0 -54
- package/cli/dist/commands/change.d.ts.map +0 -1
- package/cli/dist/commands/change.js +0 -243
- package/cli/dist/commands/change.js.map +0 -1
- package/cli/dist/commands/clean.d.ts +0 -15
- package/cli/dist/commands/clean.d.ts.map +0 -1
- package/cli/dist/commands/clean.js +0 -63
- package/cli/dist/commands/clean.js.map +0 -1
- package/cli/dist/commands/clone.d.ts +0 -15
- package/cli/dist/commands/clone.d.ts.map +0 -1
- package/cli/dist/commands/clone.js +0 -49
- package/cli/dist/commands/clone.js.map +0 -1
- package/cli/dist/commands/config.d.ts +0 -33
- package/cli/dist/commands/config.d.ts.map +0 -1
- package/cli/dist/commands/config.js +0 -166
- package/cli/dist/commands/config.js.map +0 -1
- package/cli/dist/commands/context.d.ts +0 -38
- package/cli/dist/commands/context.d.ts.map +0 -1
- package/cli/dist/commands/context.js +0 -205
- package/cli/dist/commands/context.js.map +0 -1
- package/cli/dist/commands/create.d.ts +0 -18
- package/cli/dist/commands/create.d.ts.map +0 -1
- package/cli/dist/commands/create.js +0 -178
- package/cli/dist/commands/create.js.map +0 -1
- package/cli/dist/commands/diff.d.ts +0 -19
- package/cli/dist/commands/diff.d.ts.map +0 -1
- package/cli/dist/commands/diff.js +0 -104
- package/cli/dist/commands/diff.js.map +0 -1
- package/cli/dist/commands/doctor.d.ts +0 -14
- package/cli/dist/commands/doctor.d.ts.map +0 -1
- package/cli/dist/commands/doctor.js +0 -62
- package/cli/dist/commands/doctor.js.map +0 -1
- package/cli/dist/commands/export.d.ts +0 -28
- package/cli/dist/commands/export.d.ts.map +0 -1
- package/cli/dist/commands/export.js +0 -135
- package/cli/dist/commands/export.js.map +0 -1
- package/cli/dist/commands/import.d.ts +0 -23
- package/cli/dist/commands/import.d.ts.map +0 -1
- package/cli/dist/commands/import.js +0 -118
- package/cli/dist/commands/import.js.map +0 -1
- package/cli/dist/commands/prompt.d.ts +0 -45
- package/cli/dist/commands/prompt.d.ts.map +0 -1
- package/cli/dist/commands/prompt.js +0 -223
- package/cli/dist/commands/prompt.js.map +0 -1
- package/cli/dist/commands/spec.d.ts +0 -57
- package/cli/dist/commands/spec.d.ts.map +0 -1
- package/cli/dist/commands/spec.js +0 -279
- package/cli/dist/commands/spec.js.map +0 -1
- package/cli/dist/commands/stats.d.ts +0 -18
- package/cli/dist/commands/stats.d.ts.map +0 -1
- package/cli/dist/commands/stats.js +0 -85
- package/cli/dist/commands/stats.js.map +0 -1
- package/cli/dist/commands/task.d.ts +0 -65
- package/cli/dist/commands/task.d.ts.map +0 -1
- package/cli/dist/commands/task.js +0 -282
- package/cli/dist/commands/task.js.map +0 -1
- package/cli/dist/commands/template.d.ts +0 -17
- package/cli/dist/commands/template.d.ts.map +0 -1
- package/cli/dist/commands/template.js +0 -55
- package/cli/dist/commands/template.js.map +0 -1
- package/cli/dist/utils/agent-config.d.ts +0 -129
- package/cli/dist/utils/agent-config.d.ts.map +0 -1
- package/cli/dist/utils/agent-config.js +0 -297
- package/cli/dist/utils/agent-config.js.map +0 -1
- package/cli/dist/utils/beads-graph.d.ts +0 -17
- package/cli/dist/utils/beads-graph.d.ts.map +0 -1
- package/cli/dist/utils/beads-graph.js +0 -150
- package/cli/dist/utils/beads-graph.js.map +0 -1
- package/cli/dist/utils/beads-integration.d.ts +0 -112
- package/cli/dist/utils/beads-integration.d.ts.map +0 -1
- package/cli/dist/utils/beads-integration.js +0 -312
- package/cli/dist/utils/beads-integration.js.map +0 -1
- package/cli/dist/utils/beads-reporter.d.ts +0 -17
- package/cli/dist/utils/beads-reporter.d.ts.map +0 -1
- package/cli/dist/utils/beads-reporter.js +0 -160
- package/cli/dist/utils/beads-reporter.js.map +0 -1
- package/cli/dist/utils/cache-manager.d.ts +0 -55
- package/cli/dist/utils/cache-manager.d.ts.map +0 -1
- package/cli/dist/utils/cache-manager.js +0 -150
- package/cli/dist/utils/cache-manager.js.map +0 -1
- package/cli/dist/utils/change-manager.d.ts +0 -70
- package/cli/dist/utils/change-manager.d.ts.map +0 -1
- package/cli/dist/utils/change-manager.js +0 -412
- package/cli/dist/utils/change-manager.js.map +0 -1
- package/cli/dist/utils/config-manager-enhanced.d.ts +0 -66
- package/cli/dist/utils/config-manager-enhanced.d.ts.map +0 -1
- package/cli/dist/utils/config-manager-enhanced.js +0 -77
- package/cli/dist/utils/config-manager-enhanced.js.map +0 -1
- package/cli/dist/utils/context-manager.d.ts +0 -96
- package/cli/dist/utils/context-manager.d.ts.map +0 -1
- package/cli/dist/utils/context-manager.js +0 -258
- package/cli/dist/utils/context-manager.js.map +0 -1
- package/cli/dist/utils/diff-engine.d.ts +0 -78
- package/cli/dist/utils/diff-engine.d.ts.map +0 -1
- package/cli/dist/utils/diff-engine.js +0 -233
- package/cli/dist/utils/diff-engine.js.map +0 -1
- package/cli/dist/utils/export-system.d.ts +0 -101
- package/cli/dist/utils/export-system.d.ts.map +0 -1
- package/cli/dist/utils/export-system.js +0 -289
- package/cli/dist/utils/export-system.js.map +0 -1
- package/cli/dist/utils/health-checker.d.ts +0 -66
- package/cli/dist/utils/health-checker.d.ts.map +0 -1
- package/cli/dist/utils/health-checker.js +0 -285
- package/cli/dist/utils/health-checker.js.map +0 -1
- package/cli/dist/utils/import-system.d.ts +0 -74
- package/cli/dist/utils/import-system.d.ts.map +0 -1
- package/cli/dist/utils/import-system.js +0 -317
- package/cli/dist/utils/import-system.js.map +0 -1
- package/cli/dist/utils/module-cloner.d.ts +0 -40
- package/cli/dist/utils/module-cloner.d.ts.map +0 -1
- package/cli/dist/utils/module-cloner.js +0 -136
- package/cli/dist/utils/module-cloner.js.map +0 -1
- package/cli/dist/utils/prompt-manager.d.ts +0 -90
- package/cli/dist/utils/prompt-manager.d.ts.map +0 -1
- package/cli/dist/utils/prompt-manager.js +0 -302
- package/cli/dist/utils/prompt-manager.js.map +0 -1
- package/cli/dist/utils/spec-manager.d.ts +0 -65
- package/cli/dist/utils/spec-manager.d.ts.map +0 -1
- package/cli/dist/utils/spec-manager.js +0 -329
- package/cli/dist/utils/spec-manager.js.map +0 -1
- package/cli/dist/utils/stats-collector.d.ts +0 -74
- package/cli/dist/utils/stats-collector.d.ts.map +0 -1
- package/cli/dist/utils/stats-collector.js +0 -164
- package/cli/dist/utils/stats-collector.js.map +0 -1
- package/cli/dist/utils/template-engine.d.ts +0 -47
- package/cli/dist/utils/template-engine.d.ts.map +0 -1
- package/cli/dist/utils/template-engine.js +0 -204
- package/cli/dist/utils/template-engine.js.map +0 -1
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
You are assisting with Linux device driver development in C.
|
|
2
|
+
|
|
3
|
+
## Context
|
|
4
|
+
- Category: {category}
|
|
5
|
+
- C Standard: {c_standard}
|
|
6
|
+
- Target: Linux kernel device drivers
|
|
7
|
+
|
|
8
|
+
## Key Rules for Device Drivers
|
|
9
|
+
|
|
10
|
+
### 1. ioctl Interface Design
|
|
11
|
+
- Define ioctl commands using _IO, _IOR, _IOW, _IOWR macros
|
|
12
|
+
- Validate all user input in ioctl handlers
|
|
13
|
+
- Use copy_from_user() and copy_to_user() for data transfer
|
|
14
|
+
- Return appropriate error codes (-EINVAL, -EFAULT, -ENOTTY)
|
|
15
|
+
|
|
16
|
+
### 2. DMA (Direct Memory Access)
|
|
17
|
+
- Use dma_alloc_coherent() for DMA buffers
|
|
18
|
+
- Check dma_map_single() return with dma_mapping_error()
|
|
19
|
+
- Always unmap DMA buffers with dma_unmap_single()
|
|
20
|
+
- Use proper DMA direction flags (DMA_TO_DEVICE, DMA_FROM_DEVICE)
|
|
21
|
+
- Ensure cache coherency
|
|
22
|
+
|
|
23
|
+
### 3. Memory-Mapped I/O
|
|
24
|
+
- Use ioremap() to map device registers, never direct pointers
|
|
25
|
+
- Use readl()/writel() for 32-bit register access
|
|
26
|
+
- Use readb()/writeb() for 8-bit register access
|
|
27
|
+
- Always iounmap() in cleanup
|
|
28
|
+
- Use memory barriers (mb, rmb, wmb) when needed
|
|
29
|
+
|
|
30
|
+
### 4. Interrupt Handling
|
|
31
|
+
- Request IRQ with request_irq() or devm_request_irq()
|
|
32
|
+
- Return IRQ_HANDLED or IRQ_NONE appropriately
|
|
33
|
+
- Use threaded IRQs for complex handling
|
|
34
|
+
- Free IRQ in cleanup with free_irq()
|
|
35
|
+
- Minimize work in hard IRQ context
|
|
36
|
+
|
|
37
|
+
### 5. Resource Management
|
|
38
|
+
- Use devm_* functions for automatic cleanup
|
|
39
|
+
- Request resources (I/O ports, memory regions) before use
|
|
40
|
+
- Release ALL resources in remove/exit functions
|
|
41
|
+
- Handle probe() failures with proper cleanup
|
|
42
|
+
- Use reference counting for shared resources
|
|
43
|
+
|
|
44
|
+
{#if rules}
|
|
45
|
+
## Active Rules
|
|
46
|
+
{#each rules}
|
|
47
|
+
- {id}: {description}
|
|
48
|
+
{/each}
|
|
49
|
+
{/if}
|
|
50
|
+
|
|
51
|
+
## Example Pattern: Platform Driver
|
|
52
|
+
|
|
53
|
+
```c
|
|
54
|
+
#include <linux/module.h>
|
|
55
|
+
#include <linux/platform_device.h>
|
|
56
|
+
#include <linux/io.h>
|
|
57
|
+
#include <linux/interrupt.h>
|
|
58
|
+
|
|
59
|
+
struct example_device {
|
|
60
|
+
void __iomem *regs;
|
|
61
|
+
int irq;
|
|
62
|
+
struct device *dev;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
static irqreturn_t example_irq_handler(int irq, void *dev_id) {
|
|
66
|
+
struct example_device *edev = dev_id;
|
|
67
|
+
u32 status;
|
|
68
|
+
|
|
69
|
+
status = readl(edev->regs + STATUS_REG);
|
|
70
|
+
if (!(status & IRQ_FLAG))
|
|
71
|
+
return IRQ_NONE;
|
|
72
|
+
|
|
73
|
+
// Clear interrupt
|
|
74
|
+
writel(IRQ_FLAG, edev->regs + STATUS_REG);
|
|
75
|
+
|
|
76
|
+
// Handle interrupt
|
|
77
|
+
dev_dbg(edev->dev, "Interrupt handled: 0x%x\n", status);
|
|
78
|
+
|
|
79
|
+
return IRQ_HANDLED;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
static int example_probe(struct platform_device *pdev) {
|
|
83
|
+
struct example_device *edev;
|
|
84
|
+
struct resource *res;
|
|
85
|
+
int ret;
|
|
86
|
+
|
|
87
|
+
edev = devm_kzalloc(&pdev->dev, sizeof(*edev), GFP_KERNEL);
|
|
88
|
+
if (!edev)
|
|
89
|
+
return -ENOMEM;
|
|
90
|
+
|
|
91
|
+
edev->dev = &pdev->dev;
|
|
92
|
+
|
|
93
|
+
// Map device registers
|
|
94
|
+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
|
95
|
+
edev->regs = devm_ioremap_resource(&pdev->dev, res);
|
|
96
|
+
if (IS_ERR(edev->regs))
|
|
97
|
+
return PTR_ERR(edev->regs);
|
|
98
|
+
|
|
99
|
+
// Get and request IRQ
|
|
100
|
+
edev->irq = platform_get_irq(pdev, 0);
|
|
101
|
+
if (edev->irq < 0)
|
|
102
|
+
return edev->irq;
|
|
103
|
+
|
|
104
|
+
ret = devm_request_irq(&pdev->dev, edev->irq, example_irq_handler,
|
|
105
|
+
0, dev_name(&pdev->dev), edev);
|
|
106
|
+
if (ret) {
|
|
107
|
+
dev_err(&pdev->dev, "Failed to request IRQ\n");
|
|
108
|
+
return ret;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
platform_set_drvdata(pdev, edev);
|
|
112
|
+
dev_info(&pdev->dev, "Driver probed successfully\n");
|
|
113
|
+
|
|
114
|
+
return 0;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
static int example_remove(struct platform_device *pdev) {
|
|
118
|
+
dev_info(&pdev->dev, "Driver removed\n");
|
|
119
|
+
return 0;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
static const struct of_device_id example_of_match[] = {
|
|
123
|
+
{ .compatible = "vendor,example-device" },
|
|
124
|
+
{ }
|
|
125
|
+
};
|
|
126
|
+
MODULE_DEVICE_TABLE(of, example_of_match);
|
|
127
|
+
|
|
128
|
+
static struct platform_driver example_driver = {
|
|
129
|
+
.probe = example_probe,
|
|
130
|
+
.remove = example_remove,
|
|
131
|
+
.driver = {
|
|
132
|
+
.name = "example-driver",
|
|
133
|
+
.of_match_table = example_of_match,
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
module_platform_driver(example_driver);
|
|
138
|
+
|
|
139
|
+
MODULE_LICENSE("GPL");
|
|
140
|
+
MODULE_AUTHOR("Your Name");
|
|
141
|
+
MODULE_DESCRIPTION("Example platform driver");
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Example Pattern: DMA Usage
|
|
145
|
+
|
|
146
|
+
```c
|
|
147
|
+
#include <linux/dma-mapping.h>
|
|
148
|
+
|
|
149
|
+
int setup_dma_transfer(struct device *dev, void *buffer, size_t size) {
|
|
150
|
+
dma_addr_t dma_handle;
|
|
151
|
+
int ret;
|
|
152
|
+
|
|
153
|
+
// Map buffer for DMA
|
|
154
|
+
dma_handle = dma_map_single(dev, buffer, size, DMA_TO_DEVICE);
|
|
155
|
+
if (dma_mapping_error(dev, dma_handle)) {
|
|
156
|
+
dev_err(dev, "DMA mapping failed\n");
|
|
157
|
+
return -ENOMEM;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Program DMA controller with dma_handle
|
|
161
|
+
// ...
|
|
162
|
+
|
|
163
|
+
// After transfer completes
|
|
164
|
+
dma_unmap_single(dev, dma_handle, size, DMA_TO_DEVICE);
|
|
165
|
+
|
|
166
|
+
return 0;
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
{#if examples}
|
|
171
|
+
## Additional Examples
|
|
172
|
+
{#each examples}
|
|
173
|
+
|
|
174
|
+
### {title}
|
|
175
|
+
```c
|
|
176
|
+
{code}
|
|
177
|
+
```
|
|
178
|
+
{/each}
|
|
179
|
+
{/if}
|
|
180
|
+
|
|
181
|
+
## Common Pitfalls to Avoid
|
|
182
|
+
- Direct pointer access to device memory (use ioremap)
|
|
183
|
+
- Not checking dma_mapping_error()
|
|
184
|
+
- Forgetting to unmap DMA buffers
|
|
185
|
+
- Not validating ioctl user input
|
|
186
|
+
- Memory leaks in probe error paths
|
|
187
|
+
- Not freeing IRQs in remove function
|
|
188
|
+
- Using wrong register access functions
|
|
189
|
+
|
|
190
|
+
Generate device driver code following these standards.
|
|
191
|
+
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
You are assisting with C embedded systems programming.
|
|
2
|
+
|
|
3
|
+
## Context
|
|
4
|
+
- Category: {category}
|
|
5
|
+
- C Standard: {c_standard}
|
|
6
|
+
- Target: Resource-constrained embedded systems
|
|
7
|
+
|
|
8
|
+
## Key Rules for Embedded Systems
|
|
9
|
+
|
|
10
|
+
### 1. Volatile Usage
|
|
11
|
+
**CRITICAL**: Use volatile for hardware registers and interrupt-shared variables
|
|
12
|
+
- Memory-mapped I/O registers MUST be volatile
|
|
13
|
+
- Variables modified by ISRs MUST be volatile
|
|
14
|
+
- Prevents compiler optimization that breaks hardware interaction
|
|
15
|
+
|
|
16
|
+
### 2. ISR (Interrupt Service Routine) Constraints
|
|
17
|
+
- Keep ISRs SHORT and FAST
|
|
18
|
+
- No blocking operations (no delays, no waiting)
|
|
19
|
+
- No dynamic memory allocation (malloc/free)
|
|
20
|
+
- Use atomic operations or disable interrupts for shared data
|
|
21
|
+
- Set flags for main loop to process
|
|
22
|
+
|
|
23
|
+
### 3. No Dynamic Allocation
|
|
24
|
+
- Avoid malloc(), free(), realloc() in embedded systems
|
|
25
|
+
- Use static allocation or stack allocation
|
|
26
|
+
- Pre-allocate all buffers at compile time
|
|
27
|
+
- Use fixed-size circular buffers for data streams
|
|
28
|
+
|
|
29
|
+
### 4. Fixed-Size Buffers
|
|
30
|
+
- Define buffer sizes at compile time
|
|
31
|
+
- Use circular/ring buffers for streaming data
|
|
32
|
+
- Implement overflow protection
|
|
33
|
+
- Document buffer sizes and constraints
|
|
34
|
+
|
|
35
|
+
### 5. Hardware Register Access
|
|
36
|
+
- Use memory-mapped I/O with proper volatile pointers
|
|
37
|
+
- Follow datasheet specifications exactly
|
|
38
|
+
- Use bit manipulation macros for clarity
|
|
39
|
+
- Document register addresses and bit fields
|
|
40
|
+
|
|
41
|
+
{#if rules}
|
|
42
|
+
## Active Rules
|
|
43
|
+
{#each rules}
|
|
44
|
+
- {id}: {description}
|
|
45
|
+
{/each}
|
|
46
|
+
{/if}
|
|
47
|
+
|
|
48
|
+
## Example Pattern: Hardware Register Access
|
|
49
|
+
|
|
50
|
+
```c
|
|
51
|
+
#include <stdint.h>
|
|
52
|
+
|
|
53
|
+
// Hardware register definitions
|
|
54
|
+
#define GPIO_BASE 0x40020000
|
|
55
|
+
#define GPIO_MODER (*(volatile uint32_t*)(GPIO_BASE + 0x00))
|
|
56
|
+
#define GPIO_ODR (*(volatile uint32_t*)(GPIO_BASE + 0x14))
|
|
57
|
+
#define GPIO_IDR (*(volatile uint32_t*)(GPIO_BASE + 0x10))
|
|
58
|
+
|
|
59
|
+
// Bit manipulation macros
|
|
60
|
+
#define BIT_SET(reg, bit) ((reg) |= (1U << (bit)))
|
|
61
|
+
#define BIT_CLEAR(reg, bit) ((reg) &= ~(1U << (bit)))
|
|
62
|
+
#define BIT_READ(reg, bit) (((reg) >> (bit)) & 1U)
|
|
63
|
+
|
|
64
|
+
void gpio_init(void) {
|
|
65
|
+
// Set pin 5 as output
|
|
66
|
+
GPIO_MODER &= ~(3U << (5 * 2)); // Clear mode bits
|
|
67
|
+
GPIO_MODER |= (1U << (5 * 2)); // Set as output
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
void gpio_set_pin(uint8_t pin) {
|
|
71
|
+
BIT_SET(GPIO_ODR, pin);
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Example Pattern: Interrupt Service Routine
|
|
76
|
+
|
|
77
|
+
```c
|
|
78
|
+
#include <stdint.h>
|
|
79
|
+
#include <stdbool.h>
|
|
80
|
+
|
|
81
|
+
// Shared with ISR - MUST be volatile
|
|
82
|
+
volatile bool data_ready = false;
|
|
83
|
+
volatile uint8_t received_byte = 0;
|
|
84
|
+
|
|
85
|
+
// ISR: Keep SHORT and FAST
|
|
86
|
+
void UART_IRQHandler(void) {
|
|
87
|
+
if (UART_STATUS & UART_RX_FLAG) {
|
|
88
|
+
received_byte = UART_DATA; // Read data
|
|
89
|
+
data_ready = true; // Set flag
|
|
90
|
+
UART_STATUS = UART_RX_FLAG; // Clear flag
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Main loop processes data
|
|
95
|
+
void main_loop(void) {
|
|
96
|
+
while (1) {
|
|
97
|
+
if (data_ready) {
|
|
98
|
+
data_ready = false;
|
|
99
|
+
process_byte(received_byte);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Example Pattern: Circular Buffer (No Dynamic Allocation)
|
|
106
|
+
|
|
107
|
+
```c
|
|
108
|
+
#include <stdint.h>
|
|
109
|
+
#include <stdbool.h>
|
|
110
|
+
|
|
111
|
+
#define BUFFER_SIZE 64
|
|
112
|
+
|
|
113
|
+
typedef struct {
|
|
114
|
+
uint8_t data[BUFFER_SIZE];
|
|
115
|
+
volatile uint16_t head;
|
|
116
|
+
volatile uint16_t tail;
|
|
117
|
+
} circular_buffer_t;
|
|
118
|
+
|
|
119
|
+
static circular_buffer_t rx_buffer = {0};
|
|
120
|
+
|
|
121
|
+
bool buffer_put(circular_buffer_t *buf, uint8_t byte) {
|
|
122
|
+
uint16_t next_head = (buf->head + 1) % BUFFER_SIZE;
|
|
123
|
+
|
|
124
|
+
if (next_head == buf->tail) {
|
|
125
|
+
return false; // Buffer full
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
buf->data[buf->head] = byte;
|
|
129
|
+
buf->head = next_head;
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
bool buffer_get(circular_buffer_t *buf, uint8_t *byte) {
|
|
134
|
+
if (buf->head == buf->tail) {
|
|
135
|
+
return false; // Buffer empty
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
*byte = buf->data[buf->tail];
|
|
139
|
+
buf->tail = (buf->tail + 1) % BUFFER_SIZE;
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
{#if examples}
|
|
145
|
+
## Additional Examples
|
|
146
|
+
{#each examples}
|
|
147
|
+
|
|
148
|
+
### {title}
|
|
149
|
+
```c
|
|
150
|
+
{code}
|
|
151
|
+
```
|
|
152
|
+
{/each}
|
|
153
|
+
{/if}
|
|
154
|
+
|
|
155
|
+
## Common Pitfalls to Avoid
|
|
156
|
+
- Forgetting volatile on hardware registers
|
|
157
|
+
- Using malloc/free in embedded code
|
|
158
|
+
- Long-running ISRs blocking other interrupts
|
|
159
|
+
- Not protecting shared data between ISR and main
|
|
160
|
+
- Unbounded buffers causing memory overflow
|
|
161
|
+
- Non-atomic operations on multi-byte shared variables
|
|
162
|
+
|
|
163
|
+
Generate embedded C code following these constraints.
|
|
164
|
+
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
You are assisting with Linux kernel module development in C.
|
|
2
|
+
|
|
3
|
+
## Context
|
|
4
|
+
- Category: {category}
|
|
5
|
+
- C Standard: {c_standard}
|
|
6
|
+
- Target: Linux kernel space programming
|
|
7
|
+
|
|
8
|
+
## Key Rules for Kernel Development
|
|
9
|
+
|
|
10
|
+
### 1. Kernel API Usage
|
|
11
|
+
- Use kernel-provided functions (kmalloc, kfree, printk)
|
|
12
|
+
- NO standard library functions (printf, malloc, strcpy)
|
|
13
|
+
- Follow kernel coding style (Documentation/process/coding-style.rst)
|
|
14
|
+
- Use kernel types (u8, u16, u32, u64, __be32, etc.)
|
|
15
|
+
|
|
16
|
+
### 2. Memory Management
|
|
17
|
+
- Use kmalloc() with appropriate GFP flags (GFP_KERNEL, GFP_ATOMIC)
|
|
18
|
+
- ALWAYS check kmalloc() return value for NULL
|
|
19
|
+
- Free memory with kfree() - no memory leaks
|
|
20
|
+
- Use GFP_ATOMIC in interrupt context, GFP_KERNEL otherwise
|
|
21
|
+
- Consider using slab allocators for frequent allocations
|
|
22
|
+
|
|
23
|
+
### 3. Locking and Synchronization
|
|
24
|
+
- Protect shared data with spinlocks or mutexes
|
|
25
|
+
- Use spinlocks for short critical sections
|
|
26
|
+
- Use mutexes for longer critical sections (can sleep)
|
|
27
|
+
- NEVER sleep while holding a spinlock
|
|
28
|
+
- Avoid deadlocks: acquire locks in consistent order
|
|
29
|
+
|
|
30
|
+
### 4. Error Handling
|
|
31
|
+
- Return negative error codes (e.g., -ENOMEM, -EINVAL, -EIO)
|
|
32
|
+
- Use ERR_PTR() and IS_ERR() for pointer returns
|
|
33
|
+
- Clean up resources on error paths (goto error handling)
|
|
34
|
+
- Log errors with pr_err() or dev_err()
|
|
35
|
+
|
|
36
|
+
### 5. Module Lifecycle
|
|
37
|
+
- Implement module_init() and module_exit()
|
|
38
|
+
- Clean up ALL resources in exit function
|
|
39
|
+
- Use reference counting for shared resources
|
|
40
|
+
- Handle module unload gracefully
|
|
41
|
+
|
|
42
|
+
{#if rules}
|
|
43
|
+
## Active Rules
|
|
44
|
+
{#each rules}
|
|
45
|
+
- {id}: {description}
|
|
46
|
+
{/each}
|
|
47
|
+
{/if}
|
|
48
|
+
|
|
49
|
+
## Example Pattern: Basic Kernel Module
|
|
50
|
+
|
|
51
|
+
```c
|
|
52
|
+
#include <linux/module.h>
|
|
53
|
+
#include <linux/kernel.h>
|
|
54
|
+
#include <linux/init.h>
|
|
55
|
+
|
|
56
|
+
MODULE_LICENSE("GPL");
|
|
57
|
+
MODULE_AUTHOR("Your Name");
|
|
58
|
+
MODULE_DESCRIPTION("Example kernel module");
|
|
59
|
+
MODULE_VERSION("1.0");
|
|
60
|
+
|
|
61
|
+
static int __init example_init(void) {
|
|
62
|
+
pr_info("Example module loaded\n");
|
|
63
|
+
return 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static void __exit example_exit(void) {
|
|
67
|
+
pr_info("Example module unloaded\n");
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
module_init(example_init);
|
|
71
|
+
module_exit(example_exit);
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Example Pattern: Character Device Driver
|
|
75
|
+
|
|
76
|
+
```c
|
|
77
|
+
#include <linux/module.h>
|
|
78
|
+
#include <linux/fs.h>
|
|
79
|
+
#include <linux/cdev.h>
|
|
80
|
+
#include <linux/uaccess.h>
|
|
81
|
+
|
|
82
|
+
#define DEVICE_NAME "example"
|
|
83
|
+
#define BUFFER_SIZE 1024
|
|
84
|
+
|
|
85
|
+
static dev_t dev_num;
|
|
86
|
+
static struct cdev example_cdev;
|
|
87
|
+
static char device_buffer[BUFFER_SIZE];
|
|
88
|
+
|
|
89
|
+
static ssize_t example_read(struct file *filp, char __user *buf,
|
|
90
|
+
size_t count, loff_t *f_pos) {
|
|
91
|
+
size_t to_read = min(count, (size_t)(BUFFER_SIZE - *f_pos));
|
|
92
|
+
|
|
93
|
+
if (*f_pos >= BUFFER_SIZE)
|
|
94
|
+
return 0;
|
|
95
|
+
|
|
96
|
+
if (copy_to_user(buf, device_buffer + *f_pos, to_read))
|
|
97
|
+
return -EFAULT;
|
|
98
|
+
|
|
99
|
+
*f_pos += to_read;
|
|
100
|
+
return to_read;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
static ssize_t example_write(struct file *filp, const char __user *buf,
|
|
104
|
+
size_t count, loff_t *f_pos) {
|
|
105
|
+
size_t to_write = min(count, (size_t)(BUFFER_SIZE - *f_pos));
|
|
106
|
+
|
|
107
|
+
if (*f_pos >= BUFFER_SIZE)
|
|
108
|
+
return -ENOSPC;
|
|
109
|
+
|
|
110
|
+
if (copy_from_user(device_buffer + *f_pos, buf, to_write))
|
|
111
|
+
return -EFAULT;
|
|
112
|
+
|
|
113
|
+
*f_pos += to_write;
|
|
114
|
+
return to_write;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
static struct file_operations fops = {
|
|
118
|
+
.owner = THIS_MODULE,
|
|
119
|
+
.read = example_read,
|
|
120
|
+
.write = example_write,
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
static int __init example_init(void) {
|
|
124
|
+
int ret;
|
|
125
|
+
|
|
126
|
+
ret = alloc_chrdev_region(&dev_num, 0, 1, DEVICE_NAME);
|
|
127
|
+
if (ret < 0) {
|
|
128
|
+
pr_err("Failed to allocate device number\n");
|
|
129
|
+
return ret;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
cdev_init(&example_cdev, &fops);
|
|
133
|
+
ret = cdev_add(&example_cdev, dev_num, 1);
|
|
134
|
+
if (ret < 0) {
|
|
135
|
+
unregister_chrdev_region(dev_num, 1);
|
|
136
|
+
return ret;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
pr_info("Character device registered: %d:%d\n",
|
|
140
|
+
MAJOR(dev_num), MINOR(dev_num));
|
|
141
|
+
return 0;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
static void __exit example_exit(void) {
|
|
145
|
+
cdev_del(&example_cdev);
|
|
146
|
+
unregister_chrdev_region(dev_num, 1);
|
|
147
|
+
pr_info("Character device unregistered\n");
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
module_init(example_init);
|
|
151
|
+
module_exit(example_exit);
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
{#if examples}
|
|
155
|
+
## Additional Examples
|
|
156
|
+
{#each examples}
|
|
157
|
+
|
|
158
|
+
### {title}
|
|
159
|
+
```c
|
|
160
|
+
{code}
|
|
161
|
+
```
|
|
162
|
+
{/each}
|
|
163
|
+
{/if}
|
|
164
|
+
|
|
165
|
+
## Common Pitfalls to Avoid
|
|
166
|
+
- Using standard library functions (use kernel equivalents)
|
|
167
|
+
- Not checking kmalloc() return values
|
|
168
|
+
- Sleeping while holding spinlocks
|
|
169
|
+
- Memory leaks in error paths
|
|
170
|
+
- Not cleaning up resources in module_exit()
|
|
171
|
+
- Using floating point (not available in kernel)
|
|
172
|
+
- Incorrect GFP flags for memory allocation
|
|
173
|
+
|
|
174
|
+
Generate kernel module code following these standards.
|
|
175
|
+
|