summaryrefslogtreecommitdiffstats
path: root/drivers/spmi
AgeCommit message (Expand)Author
2020-02-10spmi: pmic-arb: Set lockdep class for hierarchical irq domainsStephen Boyd
2019-06-05treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284Thomas Gleixner
2019-05-21treewide: Add SPDX license identifier - Makefile/KconfigThomas Gleixner
2019-02-14spmi: pmic-arb: select IRQ_DOMAIN_HIERARCHY in KconfigBrian Masney
2019-02-09spmi: pmic-arb: revert "validate type when mapping IRQ"Brian Masney
2019-01-24spmi: pmic-arb: revert "disassociate old virq if hwirq mapping already exists"Brian Masney
2019-01-24spmi: pmic-arb: validate type when mapping IRQBrian Masney
2019-01-24spmi: pmic-arb: disassociate old virq if hwirq mapping already existsBrian Masney
2019-01-24spmi: pmic-arb: convert to v2 irq interfaces to support hierarchical IRQ chipsBrian Masney
2017-08-28spmi: pmic-arb: Move the ownership check to irq_chip callbackKiran Gunda
2017-08-28spmi: Convert to using %pOF instead of full_nameRob Herring
2017-08-28spmi: pmic-arb: Remove checking opc value not less than 0Fenglin Wu
2017-08-28spmi: pmic-arb: add support for HW version 5David Collins
2017-08-28spmi: pmic-arb: fix a possible null pointer dereferenceKiran Gunda
2017-08-28spmi: pmic-arb: return __iomem pointer instead of offsetKiran Gunda
2017-08-28spmi: pmic-arb: use irq_chip callback to set spmi irq wakeup capabilityKiran Gunda
2017-08-28spmi: pmic-arb: return the value instead of passing by pointerKiran Gunda
2017-08-28spmi: pmic-arb: replace the writel_relaxed with __raw_writelKiran Gunda
2017-08-28spmi: pmic-arb: fix memory allocation for mapping_tableKiran Gunda
2017-08-28spmi: pmic-arb: optimize qpnpint_irq_set_type functionKiran Gunda
2017-08-28spmi: pmic-arb: clean up pmic_arb_find_apid functionKiran Gunda
2017-08-28spmi: pmic-arb: rename pa_xx to pmic_arb_xx and other cleanupKiran Gunda
2017-08-28spmi: pmic-arb: remove the read/write access checksKiran Gunda
2017-07-17spmi: pmic-arb: Always allocate ppid_to_apid tableStephen Boyd
2017-07-17spmi: Include OF based modalias in device ueventBjorn Andersson
2017-06-03spmi: spmi-pmic-arb: enable the SPMI interrupt as a wakeup sourceKiran Gunda
2017-06-03spmi: pmic_arb: add support for PMIC bus arbiter v3Abhijeet Dharmapurikar
2017-06-03spmi: pmic-arb: check apid enabled before calling the handlerAbhijeet Dharmapurikar
2017-06-03spmi: pmic_arb: use appropriate flow handlerAbhijeet Dharmapurikar
2017-06-03spmi: pmic-arb: clear the latched status of the interruptAbhijeet Dharmapurikar
2017-06-03spmi: pmic-arb: fix missing interruptsAbhijeet Dharmapurikar
2017-06-03spmi: pmic-arb: cleanup unrequested irqsAbhijeet Dharmapurikar
2017-06-03spmi: pmic-arb: optimize table lookupsAbhijeet Dharmapurikar
2017-06-03spmi: pmic-arb: fix inconsistent use of apid and chanAbhijeet Dharmapurikar
2017-06-03spmi: pmic-arb: rename spmi_pmic_arb_dev to spmi_pmic_arbAbhijeet Dharmapurikar
2017-06-03spmi: pmic_arb: block access of invalid read and writesAbhijeet Dharmapurikar
2016-09-27spmi: pmic-arb: Return an error code if sanity check failsChristophe JAILLET
2016-04-30spmi: do not use bus internal dataSudip Mukherjee
2016-02-08spmi: pmic-arb: Support more than 128 peripheralsStephen Boyd
2015-11-04Merge tag 'char-misc-4.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/gi...Linus Torvalds
2015-10-13irqdomain: Use irq_domain_get_of_node() instead of direct field accessMarc Zyngier
2015-10-04spmi: pmic-arb: u8 <= 0xff is always trueStephen Boyd
2015-10-04spmi: pmic-arb: Don't byte swap when reading/writing FIFOStephen Boyd
2015-09-20spmi: Auto-populate driver.owner in spmi_driver_register()Stephen Boyd
2015-09-16genirq: Remove irq argument from irq flow handlersThomas Gleixner
2015-09-01Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kerne...Linus Torvalds
2015-08-05spmi: Select IRQ_DOMAIN instead of depend on itStephen Boyd
2015-08-05spmi: pmic-arb: add support for irq_get_irqchip_stateCourtney Cavin
2015-08-05spmi: add command tracepoints for SPMIAnkit Gupta
2015-07-29spmi/pmic: Use irq_desc_get_xxx() to avoid redundant lookup of irq_descJiang Liu
09 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326
// Copyright 2023 The Hugo Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package commands

import (
	"context"
	"errors"
	"os"
	"path/filepath"

	"github.com/bep/simplecobra"
	"github.com/gohugoio/hugo/config"
	"github.com/gohugoio/hugo/modules/npm"
	"github.com/spf13/cobra"
)

const commonUsageMod = `
Note that Hugo will always start out by resolving the components defined in the site
configuration, provided by a _vendor directory (if no --ignoreVendorPaths flag provided),
Go Modules, or a folder inside the themes directory, in that order.

See https://gohugo.io/hugo-modules/ for more information.

`

// buildConfigCommands creates a new config command and its subcommands.
func newModCommands() *modCommands {
	var (
		clean   bool
		pattern string
		all     bool
	)

	npmCommand := &simpleCommand{
		name:  "npm",
		short: "Various npm helpers.",
		long:  `Various npm (Node package manager) helpers.`,
		commands: []simplecobra.Commander{
			&simpleCommand{
				name:  "pack",
				short: "Experimental: Prepares and writes a composite package.json file for your project.",
				long: `Prepares and writes a composite package.json file for your project.

On first run it creates a "package.hugo.json" in the project root if not already there. This file will be used as a template file
with the base dependency set. 

This set will be merged with all "package.hugo.json" files found in the dependency tree, picking the version closest to the project.

This command is marked as 'Experimental'. We think it's a great idea, so it's not likely to be
removed from Hugo, but we need to test this out in "real life" to get a feel of it,
so this may/will change in future versions of Hugo.
`,
				withc: func(cmd *cobra.Command, r *rootCommand) {
					applyLocalFlagsBuildConfig(cmd, r)
				},
				run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
					h, err := r.Hugo(flagsToCfg(cd, nil))
					if err != nil {
						return err
					}
					return npm.Pack(h.BaseFs.SourceFs, h.BaseFs.Assets.Dirs)
				},
			},
		},
	}

	return &modCommands{
		commands: []simplecobra.Commander{
			&simpleCommand{
				name:  "init",
				short: "Initialize this project as a Hugo Module.",
				long: `Initialize this project as a Hugo Module.
	It will try to guess the module path, but you may help by passing it as an argument, e.g:
	
		hugo mod init github.com/gohugoio/testshortcodes
	
	Note that Hugo Modules supports multi-module projects, so you can initialize a Hugo Module
	inside a subfolder on GitHub, as one example.
	`,
				withc: func(cmd *cobra.Command, r *rootCommand) {
					applyLocalFlagsBuildConfig(cmd, r)
				},
				run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
					h, err := r.Hugo(flagsToCfg(cd, nil))
					if err != nil {
						return err
					}
					var initPath string
					if len(args) >= 1 {
						initPath = args[0]
					}
					return h.Configs.ModulesClient.Init(initPath)
				},
			},
			&simpleCommand{
				name:  "verify",
				short: "Verify dependencies.",
				long:  `Verify checks that the dependencies of the current module, which are stored in a local downloaded source cache, have not been modified since being downloaded.`,
				withc: func(cmd *cobra.Command, r *rootCommand) {
					applyLocalFlagsBuildConfig(cmd, r)
					cmd.Flags().BoolVarP(&clean, "clean", "", false, "delete module cache for dependencies that fail verification")
				},
				run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
					conf, err := r.ConfigFromProvider(r.configVersionID.Load(), flagsToCfg(cd, nil))
					if err != nil {
						return err
					}
					client := conf.configs.ModulesClient
					return client.Verify(clean)
				},
			},
			&simpleCommand{
				name:  "graph",
				short: "Print a module dependency graph.",
				long: `Print a module dependency graph with information about module status (disabled, vendored).
Note that for vendored modules, that is the version listed and not the one from go.mod.
`,
				withc: func(cmd *cobra.Command, r *rootCommand) {
					applyLocalFlagsBuildConfig(cmd, r)
					cmd.Flags().BoolVarP(&clean, "clean", "", false, "delete module cache for dependencies that fail verification")
				},
				run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
					conf, err := r.ConfigFromProvider(r.configVersionID.Load(), flagsToCfg(cd, nil))
					if err != nil {
						return err
					}
					client := conf.configs.ModulesClient
					return client.Graph(os.Stdout)
				},
			},
			&simpleCommand{
				name:  "clean",
				short: "Delete the Hugo Module cache for the current project.",
				long:  `Delete the Hugo Module cache for the current project.`,
				withc: func(cmd *cobra.Command, r *rootCommand) {
					applyLocalFlagsBuildConfig(cmd, r)
					cmd.Flags().StringVarP(&pattern, "pattern", "", "", `pattern matching module paths to clean (all if not set), e.g. "**hugo*"`)
					cmd.Flags().BoolVarP(&all, "all", "", false, "clean entire module cache")
				},
				run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
					h, err := r.Hugo(flagsToCfg(cd, nil))
					if err != nil {
						return err
					}
					if all {
						modCache := h.ResourceSpec.FileCaches.ModulesCache()
						count, err := modCache.Prune(true)
						r.Printf("Deleted %d files from module cache.", count)
						return err
					}

					return h.Configs.ModulesClient.Clean(pattern)
				},
			},
			&simpleCommand{
				name:  "tidy",
				short: "Remove unused entries in go.mod and go.sum.",
				withc: func(cmd *cobra.Command, r *rootCommand) {
					applyLocalFlagsBuildConfig(cmd, r)
				},
				run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
					h, err := r.Hugo(flagsToCfg(cd, nil))
					if err != nil {
						return err
					}
					return h.Configs.ModulesClient.Tidy()
				},
			},
			&simpleCommand{
				name:  "vendor",
				short: "Vendor all module dependencies into the _vendor directory.",
				long: `Vendor all module dependencies into the _vendor directory.
	If a module is vendored, that is where Hugo will look for it's dependencies.
	`,
				withc: func(cmd *cobra.Command, r *rootCommand) {
					applyLocalFlagsBuildConfig(cmd, r)
				},
				run: func(ctx context.Context, cd